Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zen of Coding:
PHP MVC Frameworks Preview of 2018 (Phalcon 3, Symfony 4, Laravel 5.x and Others)
Jan 05, 2018 @ 13:58:48

On the Zen of Coding site they've posted a look forward at versions of several popular frameworks coming in 2018. Their list includes Phalcon 3, Symfony 4 and Laravel 5.x.

It’s that time of the year again, when we take a look at the world of PHP MVC frameworks. We get ready for the trends of 2018 and plan our roadmaps. Also, we’ll take a quick detour to look at some seagues in the areas beyond PHP MVC.

Web development changes year over year, if not faster. MVC has been a revolutionary paradigm for modern web apps. It helped millions of developers build awesome applications and launch exciting startups.

The post includes a Google Trends chart showing the popularity of searches for various frameworks with Laravel, Symfony and CodeIgniter taking the top three spots overall. It then starts with a high level view of some of the recent changes and trends in several of the frameworks, moving into more detail for each (and some of "the rest" including CakePHP, Zend Framework and Yii. It then discusses microservices, how they relate to MVC and the continuing importance of backend functionality.

tagged: laravel symfony phalcon 2018 preview framework microservices mvc

Link: http://www.zenofcoding.com/2017/12/31/php-mvc-frameworks-preview-of-2018-phalcon-3-symfony-4-laravel-5-x-and-others/

Nwanze Franklin:
Deep dive into middlewares in Laravel
Dec 14, 2017 @ 12:46:48

Nwanze Franklin has posted a tutorial to the Dev.to site sharing a deep dive into middlewares in Laravel. Middleware is a powerful tool that can allow you to work with the request and response objects in your application in a more reproducible and contained manner.

What is a Laravel middleware? It is a feature in Laravel which provides a mechanism for filtering HTTP requests entering your application. This allows you to hook into Laravel request processing work flow to perform some kind of logic that decides how your application works.

What would you use middleware for? Protecting your routes, setting headers on HTTP responses, logging requests to your application, sanitizing incoming parameters, enable site-wide maintenance mode [and] manipulating responses generated by your application.

The tutorial then starts in on the code, showing how to create a custom middleware and the code that's generated by the artisan command. It covers the differences between global and route middleware, how to register a middleware and assigning it to a route. It ends with a look at using parameters in middleware and how to access them from the controller.

tagged: middleware laravel tutorial introduction framework route global

Link: https://dev.to/franko4don/deep-dive-into-middlewares-in-laravel-doo

JoliCode Blog:
How to properly manage translations in Symfony?
Dec 14, 2017 @ 10:13:31

The JoliCode site has posted a tutorial for the Symfony users out there sharing their method for properly managing translations when using the framework.

We already wrote about our Symfony translation workflow some years ago. But since 2015, lots of things have evolved and it was time to update this workflow.

The aim stays the same, keeping app translation simple and fluent for all stakeholders of the project. To achieve this, we had chosen an external tool: Loco, which centralizes translation data, and a piece of code written to synchronize it with Symfony translation files.

The article talks about the two main methods (bundles) used in the Symfony ecosystem to manage translations but they couldn't connect them with their chosen tool (Loco). The tutorial then shows how they moved to using the php-translation bundle and how to use the Loco UI to manage the keys connected to it. It also covers the use in testing, migrating to production and what's currently missing from Loco they'd like to see.

tagged: manage translation symfony framework tutorial loco bundle

Link: https://jolicode.com/blog/how-to-properly-manage-translations-in-symfony

Fabien Potencier:
Symfony 4: Performance out of the Box
Dec 12, 2017 @ 13:48:07

In a quick post to his site Fabien Potencier (of Sensio Labs and the Symfony framework) has a post sharing some information around the performance of Symfony 4 and what kind of speed you can expect in your applications based on it.

Performance is an interesting and sensitive topic. Suffice to say that most projects should not care too much; modern PHP frameworks are fast enough for most use cases and projects. And PHP 7 performance improvements help a lot as well. But people like to compare frameworks, and I guess performance is one way to do so.

What about Symfony 4? During its development cycle, we did some nice performance optimizations: mainly to improve the router and container speed. But several non-related changes in Symfony 4 also help with performance... Your mileage may vary depending on your specific project of course.

He talks about some of the testing and evaluation that's already been done on "Hello world" script performance but points out that this isn't a very real world situation. He shares these metrics, however, to at least give a baseline to compare it against previous Symfony versions. The post also links to another resource that shares these and other benchmarks related to various PHP projects.

tagged: symfony4 performance symfony framework version benchmark

Link: http://fabien.potencier.org/symfony4-performance.html

FormaPro Blog:
Yii PHP Framework has adopted AMQP Interop.
Dec 06, 2017 @ 09:20:16

On the FormaPro blog Maskim has written up a tutorial introducing you to a new feature that's been integrated into the Yii2 framework: AMPQ Interop, a standard structure for the handling of MQ messages (queuing).

Great News! Queue Interop is one step closer to PHP world domination.

Yii PHP Framework is the first of major frameworks that has placed a bet on AMQP Interop. A corresponding pull request “Add AMQP interop based driver.” has been merged to yiisoft/yii2-queue repository.

With this integration, the Yii framework now natively supports many AMPQ packages without having to create a custom interface layer. This includes enqueue/amqp-lib, enqueue/amqp-ext and enqueue/amqp-bunny.

tagged: formapro yii framework adoption ampq interoperability structure

Link: https://blog.forma-pro.com/yii-php-framework-has-adopted-amqp-interop-85ab47c9869f

Jerzy Zawadzki:
Symfony 4: New Hope
Dec 04, 2017 @ 11:16:56

In a new article to his Medium.com site Jerzy Zawadzki talks about why he things that Symfony 4 is "the new hope" for the framework. In the article he goes through the updates in their major version including code examples, commands and descriptions on each.

On November 30, 2017 new version of Symfony Framework has been released and it looks like core team followed the Star Wars numbering pattern, as 4th version is much better, leaving previous three behind as they look like ‘prequels’ now.

In this article, I will try to sum up all important changes made in Symfony 4, so if you are familiar with Symfony 3 and want to get known with new version? - ?this article is for YOU!

He talks about the changes in developer experience that come along with version 4 and updates to the installation process to make it even simpler. He lists out the packages that are installed in this new version and what's included by default. He then walks through the addition of other packages and tools, pulled in as custom options. Finally he talks about bundles, their use in Symfony 4 and the changes in how applications are structured based on their use.

tagged: symfony symfony4 changes framework version release feature

Link: https://medium.com/@zawadzki.jerzy/symfony-4-new-hope-dbf99dde91d8

Symfony Blog:
Symfony 4.0.0 released
Dec 01, 2017 @ 10:05:57

On the Symfony blog they've posted the official announcement about the release of Symfony 4.0.0, the latest major version of the popular framework.

Symfony 4.0.0 has just been released. [...] Read the Hello Symfony 4! blog post for a quick overview of the best new features of Symfony 4 and the best way to upgrade your existing applications to Symfony 4.

The post includes a listing of the items fixed since the previous version and links to an upgrade guide that can help you bring your apps up and working in this latest version.

tagged: symfony framework v4 release announcement

Link: http://symfony.com/blog/symfony-4-0-0-released

Symfony Finland:
State of GraphQL PHP libraries and Symfony integrations in 2017
Nov 15, 2017 @ 11:16:39

On the Symfony Finland site, there's a post that looks at the current state of GraphQL PHP libraries in 2017 and how they are integrated with applications using the Symfony framework.

GraphQL has continued to gain momentum over the course of 2017. While it's certainly not a replacement for REST in all cases, it does provide consumers of Content APIs, etc. better ergonomics than general purpose RESTful interfaces. For PHP there are currently two popular libraries, both of which have Symfony integration Bundles.

The post starts by talking about implementing GraphQL functionality in your own application and mentions the two main libraries currently used: Webonyx GraphQL PHP and Youshido GraphQL. It goes on to talk about the integrations both of these provide as bundles and a bit about what each has to offer. The post then wraps up with a look forward to the Symfony Flex support they provide and a few links to other resources about GraphQL and its use in Symfony applications.

tagged: symfony framework graphql library bundle webonyx yushido

Link: https://symfony.fi/entry/state-of-graphql-php-libraries-and-symfony-integrations-in-2017

How to Create a Custom Authentication Guard in Laravel
Nov 10, 2017 @ 11:53:25

In the TutsPlus.com site there's a tutorial posted showing you how to create a custom guard in Laravel by building on top of the current system to integrate it with a MongoDB database.

In this article, we’re going to cover the authentication system in the Laravel framework. The main aim of this article is to create a custom authentication guard by extending the core authentication system.

Laravel provides a very solid authentication system in the core that makes the implementation of basic authentication a breeze. [...] Moreover, the system itself is designed in such a way that you could extend it and plug in your custom authentication adapters as well. That’s what we'll discuss in detail throughout this article.

The article then starts out with a brief description of the two parts of the system: "guards" and "providers". It then provides the list of files that will be involved and where they belong in the overall structure. From there it's on to the configuration changes and code required to make the link to the MongoDB database and the creation of the User model and authentication provider. Next comes the code to create the guard and what's required to tie it all together and make the full system work. The tutorial wraps up with an example of testing this new guard via a simple controller call.

tagged: laravel tutorial guard authentication user framework mongodb

Link: https://code.tutsplus.com/tutorials/how-to-create-a-custom-authentication-guard-in-laravel--cms-29667

Joshua Thijssen:
Symfony's autowiring
Nov 02, 2017 @ 10:26:18

Joshua Thijssen has a new post to his site looking "under the hood" at Symfony's autowiring functionality used to locate and initialize services for the framework as needed.

When asking people if they use Symfony’s autowiring functionality, an often heard excuse why people don’t use it is because of all the magic that is happening during autowiring. But just like most impressive magic tricks, once explained, it all boils down to a few simple principles and Symfony’s autowiring is nothing different in that perspective. In this blogpost I will explain the new autowiring and autoconfiguration features, and why you should love them.

He starts off with an example of how to define services manually. He then explains how these services are used in the code and how to pass in arguments when fetching. He then moves on to the automatic generation of the services (the autowiring) and how the framework is "tricked" into using the namespace of the discovered service as the name. This is also used in dependency handling. The post then covers when the autowiring won't work, autoconfiguration and how to set defaults on service definitions (for arguments).

tagged: symfony autowiring tutorial indepth configuration framework

Link: https://adayinthelifeof.nl/2017/09/19/symfony-autowire.html