This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Join the live AMA session with Adam Silverstein on open source and WordPress core! Register Now →

“I Created Slim to Answer My Need for a Simple Development Tool,” Josh Lockhart Discusses Slim Framework and Photography

Updated on May 10, 2017

9 Min Read

Josh Lockhart is the creator of Slim Micro Framework for PHP, a well known framework for writing powerful API and web apps. He is also managing PHP The Right Way, a project that provides best practices and quality information about PHP in one place. He works as a senior web developer and special project director at New Media Campaigns.

In this interview Josh talks about his experience with PHP. He also describes how he came up with the Slim Framework and offers great advice to PHP newbies.

Josh Lockhart

Cloudways: Josh, you have extensive experience in PHP. Kindly tell our readers about yourself and how you started your career in PHP development ? What motivated you to become a PHP developer?

Josh: I began working with PHP in 2001. I created websites before then, but with GUI tools like Softpress Freeway Pro and (then) Macromedia Dreamweaver. My fascination for web development emerged from a design and print background. My father was a graphic designer since the 1970s, and I remember when he purchased his first Mac in the early ’90s. I was exposed early to professional design software like QuarkXpress, Adobe Photoshop (version 2.0, I think), and Aldus Freehand. I used his Mac and professional design software for school reports.

My father and I both made the transition from print to basic front-end web development in the late ’90s with Softpress Freeway Pro due to its layout design that parallels with QuarkXpress. We graduated to Macromedia Dreamweaver, still relying on its GUI layout tools. It wasn’t until the early 2000s that I clicked “View Source” and looked at the underlying HTML that powered the websites I was creating at the time.

I became curious about what more I could create by writing HTML instead of relying on software generators like Dreamweaver. I began learning HTML and CSS. My curiosity led me further toward dynamic websites because I wanted my websites to do more than just render flat HTML. I wanted to collect, analyze, and display information from a database. I wanted to create user login systems. I wanted to collect form submissions and generate reports. So I bought an early edition of “PHP and MySQL Web Development” by Luke Welling at the local Barnes and Noble bookstore and read it from cover to cover. That’s where my self-taught career with PHP truly began.

Cloudways: You are the author of Modern PHP. So in your opinion, how has PHP progressed over the years? Where do you see the future of PHP? And are you planning to write any new books?

Josh: I started writing about PHP after the release of version 4. PHP had only recently received OOP capabilities. Today, PHP is a very different and more mature programming language. PHP’s best selling point (and perhaps its greatest danger) is its small learning curve. It is very easy to write PHP, toss it onto a server, and see results. This is largely why I chose PHP instead of another language.

The PHP language continues to evolve. I believe namespaces, Composer, and the PHP-FIG’s autoloading PSRs are the most important and most revolutionary changes to ever come to the PHP ecosystem. Those PSRs single-handedly changed and improved how I build PHP applications. They standardize how different codebases interoperate, therefore, enabling new ways to build applications without reinventing common architectural components.

I see PHP continuing to move further toward standardization, but with a slower and more meticulous gait. I believe the latest trials and tribulations demonstrated by the PHP-FIG are indicative of this journey. Is it pretty? No. But it is a sign of a mature ecosystem seeking to standardize processes that enable better interoperability and faster development. The PHP-FIG may not be the ultimate manifestation toward that end, but the PHP-FIG is an admirable example of a journey towards a more mature and standardized future. On a more personal note, I also hope PHP will borrow and implement first-party modern data structures like those used by its competitors (notably Hack).

As for writing another book, probably! I’m not sure when just yet.

Cloudways: You are the founder of the popular PHP framework ‘Slim’. Can you tell our readers how the idea of creating a new framework came to your mind, and how do you differentiate Slim from other frameworks?

Josh: The Slim Framework was born on September 20, 2010. I created Slim to answer my need for a simple, rapid application development tool for client projects at New Media Campaigns. Many projects required an API or an internal toolchain to receive, manipulate, and publish data from one location and format to another location and format. There were, of course, many frameworks available such as Symfony, Cake, and CodeIgniter. But these frameworks were large, insular, “kitchen-sink” solutions. They were (and are) excellent tools, don’t get me wrong. But they had large learning curves, deep footprints, and far more cognitive overhead than I had time to accommodate.

I flirted with Ruby, Merb, and Sinatra in 2009. I adored Sinatra’s beauty and simplicity. I wanted that in PHP. Inspired by Sinatra, I created Slim to be a simple “micro” framework with which I could quickly create pragmatically RESTful web APIs and applications. Slim was very much an answer to my own day-to-day projects at New Media Campaigns.

Slim has since evolved through three major iterations. It is currently at major version 3. Discussions about version 4 are starting to happen. I have been less involved with version 3 due to authoring a book, Modern PHP, published by O’Reilly Media. I am also committing more of my focus and time to my day job at New Media Campaigns. Andrew Smith, Rob Allen, and many other contributors have done and continue to do a wonderful job leading development on Slim.

Cloudways: How do you think Slim will be able to compete with popular frameworks like Laravel, Zend, Symfony?

Josh: Slim has never been about market share, although it has certainly claimed a large stake of the market among PHP “micro” frameworks. Slim began as a solution to my own problems, and I wanted to share that solution with other developers. If others found it useful, great. And that became true. Many PHP developers around the world use Slim to quickly build APIs, prototypes, and web applications. Slim is actively developed and supported by a large and friendly community of developers. Slim even has its own logo, courtesy of the excellent designer Ashley Bennett.

Can Slim compete with Symfony and Laravel? Not really, because they are different kinds of tools that solve different kinds of problems. Slim is an X-Acto knife for small, precise tasks. Symfony and Laravel are powerful, well-built tool boxes for larger tasks. However, you can use Slim together with larger frameworks! I use Slim together with Laravel’s Illuminate components for many of my applications. They work very well together. And honestly, Slim’s core team is less concerned with capturing and maintaining market share; we are more concerned about providing solutions to common problems. We don’t want to conquer the world. We only want to make the world a nicer place for PHP development.

Slim’s future success depends entirely on its community. Slim has an amazing team of core developers behind it to ensure future development and support.

Cloudways: While writing code, which tools do you use for testing and debugging?

Josh: I develop on Dell’s latest XPS 15″ Core i7 laptop running Windows 10. It is a beast of a machine with a gorgeous 4k AdobeRGB display. All development happens in an Ubuntu virtual machine that is managed with Vagrant and provisioned with Ansible. I use PHPUnit for unit and integration testing. I use Xdebug for step-debugging. I use CodeShip and Travis CI, hosted continuous integration services, for running tests after each push.

Cloudways: What are your thoughts on PHP 7.1 and it’s latest features? How will it help developers in modern PHP development?

Josh: Honestly, I’ve been too busy lately to pay much attention to PHP 7.1 specifically, although, PHP 7.x is a remarkable leap forward in terms of performance. I also appreciate the continued refinement of type hinting for scalar arguments and return values; this makes code more self-documenting, reduces otherwise manual error checking that I have to do inside of methods, and enables more helpful static analysis that can surface bugs before I push code into production.

Improve Your PHP App Speed by 300%

Cloudways offers you dedicated servers with SSD storage, custom performance, an optimized stack, and more for 300% faster load times.

Cloudways: Developer’s interest in Slim has increased if we look at trends from 2005 to present. So what new features are you planning to introduce in Slim?

Josh: You’ll have to chat with Rob Allen and Andrew Smith about this one! I do know we are preparing to refine Slim’s PSR-7 implementation such that it strictly adheres to the PSR-7 standard while delegating custom functionality to a decorator. This has been a much requested change. We will refine how Slim accepts and interacts with external containers. Rob has expressed interest in future PSRs such as PSR-15 and PSR-17. There’s a lot being discussed! Stay tuned for exciting developments!

From this point forward, though, we are purposefully careful about introducing backwards-incompatible changes too quickly. There are more and more large projects, like MODX, that rely on Slim. We want to avoid changing Slim’s features and interfaces too quickly.

Cloudways: If a beginner asks for your recommendation on a PHP CMS framework, which one would you suggest?

Josh: I recommend Laravel for beginners. It’s well-built. It solves a lot of common problems. It’s easy to learn. And it has a friendly and very large developer community.

Cloudways: Who would you recommend to follow in the PHP community? Who has influenced you during your journey in the PHP world?

Josh: Follow the PHP-FIG. I recognize that its politics and arguments may be distracting at times, but the work it outputs often dictates the future development of larger PHP frameworks. As for individuals, I recommend following:

Ed Finkler has been an inspiration inside and outside of the PHP community. Chris Hartjes is THE guy for learning about PHP testing. Chris Fidao authored Servers for Hackers, an amazing resource that helps developers learn about system administration. And Cal Evans, in my eyes, is the driving force behind the PHP community. For those of you without a local PHP user group, Cal also runs the online PHP user group named Nomad PHP.

The one person who has most influenced my development as a PHP developer is undoubtedly Kris Jordan. Kris is a colleague, fellow developer, and otherwise brilliant mind who helped me refine my development abilities while working at New Media Campaigns. And he’s my rubber duck, whether he likes it or not! Kris currently teaches computer science at the University of North Carolina at Chapel Hill.

Cloudways: We discovered that you have exceptional photography skills. Is it your hobby? Or do you do it as a leisure time activity? Which camera do you use for taking snaps? And who is your inspiration behind photography

Josh: Thank you! Photography is my hobby, yes. Whenever I can find time, I grab my camera and favorite glass and venture outside to see what I can find. I also do the occasional paid shoot to fund my equipment, but I try to limit paid shoots to less-stressful jobs. I don’t want to sacrifice enjoyment for money. I favor telephoto focal lengths (portraits, sports, and wildlife). My wife favors wider focal lengths for landscapes. You can see my favorite photos at http://www.joshlockhart.com/. I’m also on Instragram at https://www.instagram.com/codeguyphoto/.

YES. Canon EF 300mm f/2.8L IS USM. Taking this baby for a spin tomorrow at NCSU.

A photo posted by Josh Lockhart (@codeguyphoto) on

I have a Canon 5D III for portrait work and a Canon 7D II for wildlife and sports. I love to shoot with my EF 70-200 f/2.8L IS II, EF 24-70 f/2.8L II, and EF 100-400 f/4.5-5.6L IS II. I’ve yet to find a better glass. I also have a Fujifilm X-T10 with a XF 23mm f/1.4 for travel. I’ve got plenty of gear in my home studio, too, including a Feisol carbon fiber tripod, a Paul C. Buff Einstein strobe, a few AlienBee 800s, and a few Speedlites.

Cloudways: How do you spend your time when you are not developing? What are your favorite places to visit?

Josh: I’m either outside taking photos, playing with my two dogs, or watching Netflix with my wife. I try to distance myself from work/code when I’m at home-it’s how I stay sane and avoid burnout. Since I’ve started photography, I love to travel. My wife and I recently travelled to Boone, North Carolina to photograph the Blue Ridge Parkway and several nearby waterfalls. Next on our list is Taiwan this October where I’ll be speaking at PHP Conf Taiwan, and then either Alaska or Italy after that.

Cloudways: Workflows play a major part in a developer’s life. What are the tools and services that you use in your development workflows?

Josh: I use Vagrant to manage a unique Ubuntu virtual machine for each project. I provision each virtual machine and my production servers with the same Ansible roles to ensure both environments are exactly the same. I use PHPStorm to write code. I use Composer on 99.999% of my projects. I write and run tests with PHPUnit. I version control my code with GitLab, which in turn triggers continuous tests on either CodeShip or Travis CI. I manage deployments with Capistrano. It’s a solid workflow that has taken several years to discover and refine. But I’m super happy with where I’m at. Docker is tempting, but I don’t believe it has matured enough for me to easily use and manage it in production.

Cloudways: Just to acknowledge our readers, can you please send us an image of what your workstation looks like? And also your camera you use for photography 🙂

Josh: When I work from home, it’s just me and my laptop at the kitchen table. When I work at the New Media Campaigns office, I plug into a larger display while my dogs curls up under my desk. My laptop pretty much lets me work wherever there’s wifi and coffee! Wherever I am, as you can see in the photo, I typically have my laptop, a camera, and my iPhone 6. That’s all I need.

josh lockhart workstation

Cloudways: What do you think about managed hosting solutions like Cloudways that provide an optimized PHP stack with features that help developers kickstart their web projects?

Josh: I believe hosted solutions like Cloudways, Heroku, or Platform.sh are *amazing* tools to quickly stage and launch PHP applications without having to worry about infrastructure. I strongly encourage exploring these hosted platforms because they abstract away most infrastructure concerns. Sometimes you just want to write and deploy code without worrying about how to setup, provision, and monitor servers. If the price is right, use a hosted platform. Managing and monitoring servers isn’t fun. Let others do that for you.

Heading: “I created Slim to answer my need for a simple, rapid application development tool”, Josh Lockhart discusses Slim Framework and his passion for photography.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Shahroze Nawaz

Shahroze is a PHP Community Manager at Cloudways - A Managed PHP Hosting Platform. Besides his work life, he loves movies and travelling.

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour

CYBER WEEK SAVINGS

  • 0

    Days

  • 0

    Hours

  • 0

    Mints

  • 0

    Sec

GET OFFER

For 4 Months &
40 Free Migrations

For 4 Months &
40 Free Migrations

Upgrade Now