For a few years there, it seemed like PHP might go the way of the dinosaurs. The reality is, PHP is doing fine in 2019. Great, even. The release of PHP7 back in 2015 breathed new life into the language and now there’s a thriving PHP ecosystem for developers to take advantage of. To help you better understand what your options are, I’ve managed to winnow down to my top 6 PHP frameworks and top 6 PHP libraries, with a little bit about why I like them. Let’s go!
Laravel absolutely comes out on top for me almost every time. I’m not alone there:developers love Laravel. The only framework that even comes close to it is Symfony, which is a respectable second. Between the Blade templating engine, Eloquent ORM, and Artisan, it’s got everything you need to quickly and accurately write production-ready PHP. Laravel sits at the perfect level of framework for me: it provides enough structure to make life easier, but enough freedom to do what you want. It has traditionally run on an MVC architecture like its competitors but since version 5.0 it has moved onto a command bus architecture that’s harder to use but is significantly more powerful.
Laravel works so well that sometimes it feels like it must be secretly a kludge of hacks piled on top of each other like jenga pieces, but the excellent documentation proves otherwise; Laravel is that good because it’s just that good.
The gap between Laravel and Symfony seems to change with every new release, but they’ve generally been pretty close. One place where Symfony has an undeniable edge is its number of supported database migrations—Laravel doesn’t play well with Oracle DBs, which can be a problem when you need that sort of power.
Symfony generally is better for big projects: enterprise clients, government departments and the like. Laravel is a bit more of a versatile workhorse, but Symfony’s a big muscular warhorse. It’s probably overkill for most projects, but it’s a really good option to have if you need it.
A bit of a weird case: CodeIgniter dropped off the map for a while and was basically unused outside of tertiary institutions and Indonesian development farms for years, but CodeIgniter 4 is on the horizon and looks to be packed with cool features that might bring the venerable old framework out of retirement. The CI4 launch has been very slow, but—as of 2019—we’re finally starting to see some major public launches.
It’s, well … it’s old school, but in modern ways. In a time when we’re moving more and more towards micro-frameworks like Slim, it’s comforting to have a full-stack MVC framework that still lets you write modern PHP. Speaking of micro-frameworks:
Slim has one job and one job only: to build APIs. It is the lightest, simplest PHP framework you’re ever likely to run across. It’s obviously not well-suited to every job, but the jobs it is suited to (fast API building) it’s an absolutely wonderful tool to have.
Another micro-framework, this time based on Symfony. More versatile than Slim. Silex was a favourite of mine, but it got end-of-lifed last year and is currently in maintenance mode. The team felt like they could get the same functionality out of Symfony and Flex, and—while they’re not wrong—I feel like Silex could’ve gone in some interesting directions if it had been allowed to grow. It’s still useful to know: studying older frameworks lets you understand newer ones.
The PHP mail() function is pretty bare-bones, and it can be a nightmare to get it to do even simple things we’ve come to expect from email in 2019. That’s where PHPmailer comes in: it’s a library that lets you send email straight from your code. CC and BCC, include attachments, enjoy better security and reliability across a huge variety of open-source projects.
An open-source photo editor that’s actually a PHP class that lets you edit in-code? Where do I sign up. Okay it’s not Photoshop, but for when you need to tweak images quickly and easily on the go, it’s absolutely invaluable. Crop, resize, even work with layers—this can be a huge timesaver for the canny developer.
Snappy lets you easily pull thumbnails, snapshots or PDFs from a URL or HTML page. With 3.4k stars and 384 forks, it’s doing respectable numbers on Github and for good reason—it’s a simple, lightweight library with a huge amount of utility.
Ever needed a big fake dataset for testing purposes? You need Faker. Whenever you need to generate a large amount of useless data quickly (whether you’re bootstrapping your database, stress testing, or trying to anonymize data you took from a production service), Faker’s got your back. It’s pretty straightforward, but useful things often are.There’s a reason it’s the most popular PHP library on Github, after all.
Read and write spreadsheets right from PHP. Supports almost all common spreadsheet formats and has a high degree of functionality—everything from calendars to invoices to forms.
A very cool machine learning library that opens up a whole lot of AI/ML possibilities you wouldn’t think possible within PHP. With the rising dominance of machine learning, you can expect this one to become more important in the next few years. It’s not currently suited for every project, but it’s one to learn and watch.
We’re seeing a PHP renaissance that nobody would’ve predicted 6–7 years ago. Our language is thriving, and it’s not going anywhere anytime soon, short of some sort of server-size revolution happening. With the right frameworks and libraries, you can do almost anything. Dream big, and dream of PHP.
Chrissy Ryland - I'm a freelance writer and blogger from Northern California. I grew up loving all things entertainment and travel and now I am blessed with a career that lets me write about both of those topics along with many others. For inquiries about a story you think I might want to cover, please contact me at firstname.lastname@example.org