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

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/

ThisData Blog:
Subscribing to Symfony's Security Events
Nov 01, 2016 @ 12:27:22

In this recent post to the ThisData blog Nick Malcolm shows you a method for subscribing to the events that the Symfony framework throws during the course of its execution with simple listeners.

Symfony is a popular web framework for PHP apps, and comes with a powerful event notification system which fires events when almost anything happens inside the system. Hooking in to these events can add advanced functionality to your app.

The most common way to listen to an event is to register either an event "listener", or an event "subscriber". We're going to use Subscribers. In this post we'll create a Subscriber which listens for successful and unsuccessful Log In events, and responds by sending information to ThisData.

He starts with a Symfony demo application and show the creation of a basic subscriber to specifically listen to the security events. In this case they're only looking for authentication failures and interactive logins. He walks through what the subscriber code is doing step-by-step and includes the registration of the subscriber. This includes an update to send the event results over to the ThisData service for easier ingestion and reporting. This final step isn't a requirement to get the subscriber working, it's just an optional step they've provided as one method to handle the eventing output.

tagged: security events thisdata symfony subscriber tutorial

Link: https://thisdata.com/blog/subscribing-to-symfonys-security-events/

Ez.no Blog:
Why PHP and Symfony, and Not Java
Oct 12, 2016 @ 11:17:05

On the Ez.no blog there's an interesting post comparing PHP and Symfony to Java and some of their own reasoning behind the choice of one over the other.

We are often asked, especially from our enterprise customers at financial institutions, why we decided to go with PHP and Symfony instead of a Java framework. And as we have actually re-considered alternatives both in 2007 and 2011, we know the answer pretty well. We also know firsthand how much PHP and the PHP ecosystem has matured and progressed the last few years, how Symfony2 and Composer provided a big jump forward, how PHP v7 and Symfony3 is positioned to provide the next, in the end making us very confident in our choice and in recommending it to others.

They then talk about some of the arguments of PHP versus Java, some that are pretty familiar to those in the PHP camp:

  • PHP is "just a scripting language"
  • Java is more scalable
  • PHP's performance is bad in comparison
  • Poor tools support for PHP

For each of these they link to more information and describe the current state of PHP and its ecosystem to help refute the claim. They then get into the Symfony portion, comparing it to similar Java frameworks, listing advantages like the large pool of Symfony developers and its vibrant community.

tagged: java language choice symfony framework misconception argument

Link: https://ez.no/Blog/Why-PHP-and-Symfony-and-not-Java

Eleven Labs:
Use the Symfony Workflow Component
Sep 29, 2016 @ 11:21:42

The Eleven Labs site has a new tutorial posted showing you how to use the Symfony workflow component, a component designed to help make performing a sequence of operations simpler.

Since Symfony 3.2, a new useful component was born: the Workflow component.

It is indeed really convenient and can simplify greatly your developments when you have to manage status workflows in your application, that occurs a lot.

The tutorial starts by helping you get the Workflow component installed (via Composer) and an example configuration defining a flow for a pull request. They then show the command to generate the flow graph so you can ensure the workflow is correct. From there example code is provided to use the workflow and do things like:

  • checking if you can transition to a certain state
  • get the list of enabled transitions
  • event handling

Code examples and configuration options are also included for these points, helping you to make your workflow even more flexible.

tagged: tutorial symfony workflow component example

Link: http://blog.eleven-labs.com/en/symfony-workflow-component/

SitePoint PHP Blog:
Single-File Symfony Apps? Yes, with MicroKernelTrait!
Sep 28, 2016 @ 12:19:44

The SitePoint PHP blog has an interesting tutorial posted from author Deji Akala showing you how to create a "single file Symfony application" using the MicroKernelTrait, a recently added piece of functionality that, while added for other uses, can be easily adapted to make a "Single File Application".

A Single Page Application (SPA) offers a desktop experience to users of a web application by loading a single HTML page, and dynamically updating it as required without reloading. However, a Symfony application may have hundreds of classes, and in a basic application we end up with lots of files we don’t really need.

The latest versions of Symfony (2.8 and 3.0) introduce us to the concept of a Single File Application (SFA) – a super-slim application or micro-framework implemented in one file.

The tutorial is then broken down into three steps towards creating this application:

  • Step 1: Install Barebones Symfony
  • Step 2: The Front Controller
  • Step 3: The Kernel Class

The last step in that process is where most of the code is created and the work is done. It helps you build out the "SfaKernel" class (using MicroKernelTrait), add a few basic routes and the handlers to match them. There's also a bit about container configuration and adding in other bundles you might need. The tutorial finishes out with a look at potential use cases for a single file application like this such as microservices.

tagged: tutorial symfony microkerneltrait singlefile application

Link: https://www.sitepoint.com/single-file-symfony-apps-yes-with-microkerneltrait/

Symfony Blog:
Symfony Reaches 500 Million Downloads
Sep 27, 2016 @ 12:09:06

The Symfony blog has posted an announcement about the major milestone the project has reached - the framework has passed 500 million downloads since the original release of the first versions of Symfony 2.

We did it! On September 26th, we achieved a huge milestone: 500 million Symfony packages have been downloaded by the PHP community! Thank you to the countless developers, contributors, companies, conferences and users that have made this massive number a reality. The Symfony ecosystem now consists of over 70 packages, several of which are downloaded, on average, over 50 thousand times every day!

The rest of the post talks about the road that lead to 500 million downloads, the pervasiveness of Symfony components and the work they've done on the Backwards Compatibility Promise and Continuous Upgrade Path. The post also includes several pictures members of the Symfony community took as the counter approached the 500 million mark.

tagged: symfony framework downloads 500million milestone reached community

Link: http://symfony.com/blog/symfony-reaches-500-million-downloads

Symfony Blog:
Symfony in the US: News from North America!
Sep 22, 2016 @ 10:55:35

On the Symfony blog there's an announcement about a few Symfony speakers that are coming to North America (despite the cancelation of SymfonyLive here in the U.S.). These speakers will be a part of the "Symfony Live Track" at this year's php[world] conference happening in Washington, D.C. in November.

In reality, Symfony owes its success to countless people and companies who have not only used Symfony, they've become evangelists, by showing Symfony to friends, writing blog posts, speaking at user groups, creating bundles and using Symfony to create real-world apps that do incredible things.

[...] All that work has made Symfony hugely popular in Europe and other places. And now, we're turning up the heat where I live: the USA! Adoption is already growing fast - especially with the release of Drupal 8 - but there's still a huge opportunity to evangelize and support Symfony here.

[The track]https://world.phparch.com/session-track/symfony/) will include talks from Fabien Potencier and Nicolas Grekas and others. It will cover topics like:

  • Symfony 3, the Key Concepts
  • Migration Guide to Symfony 3.0
  • Profiling PHP Applications
  • Symfony vs Silex, Micro vs Full Stack

Check out the full track for more information about these and other talks to be presented during the week.

tagged: symfony phpworld16 symfonylive track announcement

Link: http://symfony.com/blog/symfony-in-the-us-news-from-north-america

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

CloudWays Blog:
Getting Started With Silex Micro-Framework On Cloud Hosting
Sep 19, 2016 @ 11:54:34

On the CloudWays blog they've posted a tutorial that introduces you to the Silex framework, a product from SensioLabs of Symfony fame and using it on a cloud hosting platform (their own).

Extensibility is one of the main aims of web app development projects. However, there are times when you need to get things up and running as soon as possible and with minimum time dedicated to coding. This is where micro-framework s really outshine the competition. There is a long list of these frameworks including Silex, Slim, Lumen, etc. These are ideal for developing small-scale applications with clean code and user defined directory structures.

In this tutorial I am going to explain how to install Silex, its operation, directory structure, Routings and HTTP Requests. Silex is a micro-framework written in Symfony and inspired by Sinatra, a DSL for quickly creating web applications in Ruby with minimal effort.

They start by helping you get the CloudWays instance up and running with their "PHPStack" setup. Once created they show how to get to a command prompt, make the public HTML directory and use Composer to install Silex and Twig (for templating). The tutorial then briefly covers the directory structure for the site and the code to create the Silex application instance. They define some of the basic routing (to work with book data) and show the handling for sending feedback submitted via a simple page. The remainder of the tutorial shows the use of different features of Silex including: providers, middleware, before/after handlers and defining controllers as classes.

tagged: silex introduction tutorial microframework symfony

Link: https://www.cloudways.com/blog/install-silex-on-cloud/

Symfony Blog:
The Road to 500 Million Symfony Downloads
Sep 09, 2016 @ 10:31:58

On the Symfony blog there's a new post about a major upcoming milestone for the framework: their 500 millionth download of version 2.0 of the framework.

Symfony 2.0 was released on July 28th, 2011. The biggest difference from Symfony 1.x was the internal architecture of the framework, which was designed around a set of stand-alone and decoupled PHP packages called Symfony Components.

In the five years since it's initial release the download count is getting closer to the 500 million mark all the time. They've even provided a real-time(ish) dashboard of the current count so you can keep track yourself if you'd like. The post also asks the Symfony users out there to share some of their own photos on Twitter of when the milestone is reached and even offers potential prizes to those that participate (a raffle).

So talk to your work mates, prepare a way to display symfony.com/500million in your office and share some photos of the moment so you get a chance to win. And while we wait for the moment ... keep downloading those Symfony packages!
tagged: fivehundred million downloads symfony framework components

Link: http://symfony.com/blog/the-road-to-500-million-symfony-downloads