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

Fabien Potencier:
Symfony 4: A quick Demo
May 05, 2017 @ 09:39:52

Fabien Potencier has continued his post series covering the next major release of the Symfony framework, Symfony 4. In this latest post he walks you through a quick demonstration of the creation of a new Symfony 4 application including a simple administration system.

Time to test Symfony 4... or at least let's test the experience of developing Symfony 4 projects with Symfony 3.3. Keep in mind that all the tools are in preview mode. Features might evolve over time. I'm waiting for your feedback! The first stable version of Symfony Flex will not be released before Symfony 4 at the end of November 2017. It gives the community plenty of time to discuss the changes I have described in this series of blog posts.

He then walks through the process for creating the application:

  • Using Composer's "create-project" to make a new skeleton application
  • Setting it up as a git repository
  • Defining environment variables
  • Registering the framework bundle
  • Installing the command line tools

With the basic application set up he then shows how to install the EasyAdminBundle to create the simple administrative interface. He's also created a screencast showing this same process so you can see it all in action.

tagged: symfony4 demo screencast skeleton application bundle install

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

Fabien Potencier:
Symfony 4: Best Practices
Apr 10, 2017 @ 11:51:34

Fabien Potencier (creator of the Symfony framework) has a new post on his site continuing his look at Symfony 4. In this latest article he looks at some of the best practices to use in the next major release of the framework based on some of the architectural changes coming down the line.

Any major version of a project is an opportunity to revisit its best practices. Modernizing them. Adapting them to the project's new features. Symfony 4 is no exception.

He breaks it up into a few different sections offering tips around each, just to get you thinking about the path ahead with v4 releases:

  • Standardization first (using more standard tools)
  • Bundle-less Applications
  • Environment Variables
  • Unified Web Front Controller
  • Makefile
  • Assets Management

Each item includes a description of some of the changes coming and what behaviors you'll need to modify to make life smoother in the Symfony 4 transition.

tagged: symfony4 bestpractice list framework standardize bundle environment makefile assets

Link: http://fabien.potencier.org/symfony4-best-practices.html

Fabien Potencier:
Symfony 4: Monolith vs Micro
Apr 05, 2017 @ 09:43:14

Fabien Potencier is back with a new post on his site following up this article about application composition and Symfony 4. In his latest post he compares two approaches to applications: micro versus macro.

Monolith projects versus micro-applications; a never-ending debate. Both ways to develop applications are fine in my book. Symfony supports both. Even if the Symfony Standard Edition is probably more suitable for monolith projects as it depends on the symfony/symfony package.

[...] Silex took another approach where each individual components are required when needed. Does it make Silex simpler, more lightweight, or faster than Symfony? No. Nevertheless, Symfony 4 is going to be more similar to Silex in this regard.

He talks about changes upcoming in Symfony 4 including the move away from the "symfony/symfony" package system and in with a component/bundle driven system. He gets into a specific example around the "symfony-framework" bundle. He then comes back around to the idea of "composition" of applications, adding Symfony dependencies only when needed but still having them work together seamlessly. The post ends with a discussion that was had about going the "bundle-less application" route and, while Symfony 4 will recommend it, the bundle system will still function as expected.

tagged: symfony symfony4 bundle application micro macro framework

Link: http://fabien.potencier.org/symfony4-monolith-vs-micro.html

Robert Basic:
Loading fixtures for a Symfony app in Behat tests
Mar 23, 2017 @ 10:38:58

Robert Basic has a new post to his site with some advice for the Behat users out there testing their Symfony applications. He shows how to easily load up fixture data with the help of Doctrine.

Performing end to end testing of any application requires from us to have a set of reliable test data in the database.

If we write a Symfony application and use Behat to do the end to end testing, the we can use the Doctrine fixtures bundle to create the required fixture loaders and load them in our Behat scenarios when required.

He walks you through the installation of the Doctrine fixtures bundle (via Composer, naturally) and how to enable it via the Symfony kernel configuration. He then includes an example of the fixture loader class from the FOSUserBundle and how it works. Next up is the installation of the Behat Symfony 2 extension and a bit of extra code to make a new feature context for Behat containing a "loadDataFixtures" method to do the heavy lifting.

tagged: fixture symfony application behat load extension bundle tutorial

Link: https://robertbasic.com/blog/loading-fixtures-for-a-symfony-app-in-behat-tests/

Eleven Labs Blog:
RabbitMQ: Publish, Consume, and Retry Messages
Feb 03, 2017 @ 12:53:06

On the Eleven Labs blog they're posted a tutorial showing you how to integrate RabbitMQ functionality into your Symfony-based application making use of a few handy tools that do some of the heavy lifting for you and how messages are handled (and what to do when they error).

RabbitMQ is a message broker, allowing to process things asynchronously. There’s already an article written about it, if you’re not familiar with RabbitMQ.

What I’d like to talk to you about is the lifecycle of a message, with error handling. Everything in a few lines of code. Therefore, we’re going to configure a RabbitMQ virtual host, publish a message, consume it and retry publication if any error occurs.

They use the RabbitMQ admin toolkit and Swarrot packages to get the job done. First up is the configuration of the tools, creating a default_vhost.yml file defining a queue and setting up the exchanges and parameters for the default route ("/"). They show an example of what the RabbitMQ UI looks like with this new exchange up and working and how to get more information about this "default" queue. Next up is the consumption and publication of messages. They include an example app/config/config.yml file that defines some settings the Swarrot library (via the SwarrotBundle) needs to understand the connections, consumers and type of provider to use. Finally he shows the configuration so it all knows how to publish messages and a quick example of PHP code that sends a simple string message to be handled by the RabbitMQ workers. The post ends with a bit more configuration and some examples of how to handle errors in this Swarrot/RabbitMQ Admin Toolkit setup and making use of some middleware to help with message retries and number of attempts.

tagged: tutorial rabbitmq symfony bundle swarrot configuration publish consume retry error

Link: http://blog.eleven-labs.com/en/rabbitmq-publish-consume-retry-messages/

Stovepipe Systems:
What are Bundles in Symfony?
Dec 06, 2016 @ 10:22:56

On the Stovepipe Systems Dev blog today Iltar van der Berg has shared a post about bundles, one of the key concepts in the Symfony ecosystem - what they are and some of the common features they all share.

People often refer to bundles as modules or re-usable code for Symfony applications. When a developer has experience with Symfony1 or another framework with the module concept, it might seem logical that this is what a bundle represents in Symfony.

So what is a bundle? When do you need one and what can it do? What's the difference between an AppBundle and a vendor Bundle?

He starts with the release of Symfony 2, including bundle support, and how common practices created hard dependencies between bundles. This created issues in the applications and reusability of the bundles (their whole purpose) so a solution was created: the AppBundle. This bundle shifted the emphasis away from the file structure of the bundles and more towards the domain they occupied, handling some "magic" references automatically for you.

As mentioned, the bundle provides an extension point. Other bundles for example, can hook in on your bundle because it contains some logic to expose information such as the directory of the bundle.

[...] The main purpose of a bundle however, is to provide an extension point for the Dependency Injection Container. When talking about this extension point, it revolves around adding, changing or removing service definitions.

tagged: symfony bundle introduction appbundle vendor

Link: https://stovepipe.systems/post/what-are-bundles-in-symfony

Symfony Finland:
Symfony Flex set to enable RAD (Rapid Application Development)
Dec 05, 2016 @ 11:58:37

On the Symfony Finland site there's a post that gets into the details of one of the new advancements in the Symfony ecosystem recently announced by Fabien Potencier at SymfonyCon Berlin 2016 - Symfony Flex.

The Symfony team has acknowledged this gap in their offering. And at SymfonyCon Berlin 2016 project lead Fabien Potencier announced what is known as Symfony Flex. Details are not precise, as I was not attending conference, but the tag line for Symfony Flex is: "Composition over Inheritance"

In essence it seems that Flex will allow for zero-config installation of Bundles. This is done using a Composer plugin. You will simply install packages with Composer and if the Bundle supports it, Composer will also author the necessary integration code and configuration.

As with any new thing, Flex support will start out pretty limited but as it grows in support the community should help it thrive in the Symfony ecosystem. The first release of the tooling for Flex will be available in early 2017.

tagged: symfony flex composer package bundle composition installation

Link: https://www.symfony.fi/entry/symfony-flex-to-enable-rad-rapid-application-development

MyBuilder Tech Blog:
Managing Background Processes within Symfony
Dec 02, 2016 @ 11:19:47

Edd Mann has written up a tutorial for the MyBuilder.com Tech blog about managing background processes in a Symfony application with the help of Supervisor.

When a web application reaches a sufficiently large size, it can become infeasible to perform all actions required within a single web request/response life-cycle. You may find yourself wishing to for example - batch up and send queued emails at particular intervals, or process payments asynchronous to the point in-time the user made the initial request. In this post I would like to discuss our changing use of background processes (both time-dependent and continuous) due to increasing throughput demands.

He starts out with the first approach most applications take when needing to run automated, asynchronous processes - cron. Using it and a custom bundle they created for it, Edd shows how to directly integrate the cron timing of commands into the class attributes. However, after a while the system grew and it needed something a bit more powerful than cron, something that could correctly handle long running processes. Ultimately they decided on Supervisor, a processes manager and control system that makes managing these processes simpler. He talks about the transition they made from cron over to Supervisor (safely) and how they integrated the signaling functionality Supervisor allows into their application.

tagged: symfony background process manage cron supervisor tutorial bundle

Link: http://tech.mybuilder.com/managing-background-processes-within-symfony/

Sound of Symfony Podcast:
Episode 16 - Building a better bundle
Nov 28, 2016 @ 10:35:54

The Sound of Symfony podcast, hosted by Magnus Nordlander and Tobias Nyholm, has posted their latest episode - Episode #16: Building a better bundle.

In this episode we discuss what makes a good Symfony bundle, and how you as a bundle author can build a better bundle.

You can listen to this latest episode either using the in-page audio player or by downloading the mp3 directly. If you enjoy the show, be sure to follow them on Twitter and subscribe to their feed to get the latest on new shows as they're released. You can also view the archives from the main page of the site.

tagged: soundofsymfony podcast ep16 bundle tips building

Link: http://www.soundofsymfony.com/episode/episode-16/

Symfony Finland:
Symfony & staying relevant: React.js rendering, GraphQL and Neo4j OGM
Sep 20, 2016 @ 11:15:50

On the Symfony Finland site there's a new post providing some examples of how the Symfony framework is staying relevant with new technologies and trends that have emerged recently in the web development world.

Symfony2 just turned five years old some months ago. This is an eternity in the web world and you average technology stack has likely grown in complexity since then. In addition to the standard components in LAMP you'll likely be peddling with a number of complementary technologies.

[...] The stability and flexibility have enabled Symfony to take hold also in more conservative industries like travel, where the backend systems are critical. [...] Next let's take a few options that developers of contemporary web applications may choose to adopt in their Symfony full stack framework applications when needed.

The post covers three "in style" technologies and how the Symfony framework (and community) are keeping pace:

  • React.js Server Side Rendering with ReactBundle
  • GraphQL APIs with the GraphQLBundle
  • An Graph Database storage layer using Neo4j over PHP OGM

Each point includes a bit of information about both the technology and the related bundle with plenty of links to other resources and tutorials.

tagged: symfony relevance reactjs graphql neo4j ogm bundle

Link: https://www.symfony.fi/entry/symfony-staying-relevant-react-js-rendering-graphql-and-neo4j-ogm