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

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

Cloudways Blog:
How To Create Simple Rest API In Symfony 3.1
Aug 30, 2016 @ 12:59:10

The Cloudways blog has posted a new tutorial helping you get up and running quickly with a simple REST API written using the Symfony framework. In the article they not only explain how to create the API but also include a bit of REST theory for those not completely familiar with the terms and functionality involved.

Symfony is fast becoming the favourite framework among developers for rapid application development. And despite releasing Symfony 3.1 and 3.2 in the previous quarter, they are still introducing many changes and upgrades. If you’re still using the previous versions, you must upgrade Symfony Framework to the latest and stable version 3.1.

Yes! We know that Symfony is one of the best frameworks to develop rest API, so in this article we will make simple rest API in Symfony 3.1. I am assuming that you’ve already setup PHPstack application on Cloudways with Symfony installed, but if you haven’t, follow this installation guide.

They briefly talk about the REST HTTP verb types and what kind of actions they relate to. With that defined the tutorial then gets into the requirements including the installation of two bundles: JMSSerializerBundle and NelmioCorsBundle. From there examples of configuration changes, commands to make users and execute migrations on the local database are included. With this system set up they include sample code for each HTTP verb type letting you perform the actions on the User entity (create, read, update and delete).

tagged: symfony rest api simple tutorial introduction phpstack

Link: https://www.cloudways.com/blog/rest-api-in-symfony-3-1/

Symfony Finland:
How to implement AMP (Accelerated Mobile Pages) on the eZ Platform CMS
Aug 29, 2016 @ 11:44:58

On the Symfony Finland site they've posted an introductory article showing you how to implement accelerated mobile pages (AMP) in an application based on the ez Platform CMS.

Accelerated Mobile Pages is an initiative from Google to speed up mobile browsing. AMP is an open standard based on HTML. It enforces performance by limiting functionality and includes remote caching.

Given Google's continuing dominance search both publishers and CMS vendors need to take AMP into account. In this article you'll learn the basics of how to implement AMP with eZ Platform CMS and Symfony.

The post starts out with a bit of background about AMP and how it relates back to the main content of the site. With that knowledge in place the author moves into the code, showing how to use annotations to create the route, building and returning the template including the meta and link tags required to link this AMP version back to the main content page.

tagged: tutorial amp mobile pages accelerated symfony twig meta link

Link: https://www.symfony.fi/entry/how-to-implement-amp-accelerated-mobile-pages-ez-platform-cms

Symfony Finland:
Symfony Bundle Spotlight: EasyLogHandler, eZ Migration Bundle, Netgen Layouts & Syl
Aug 23, 2016 @ 11:06:04

On the Symfony Finland blog they've posted a "spotlight" article highlighting several useful Symfony packages to help make your development life easier.

With the summer coming to an end there is increasing activity in the Symfony community in the form of bundles. Recently four interesting Symfony bundles have had interesting status updates: EasyLogHandler, eZ Migration Bundle, Netgen Layouts and Sylius.

The packages mentioned (some relatively new) are:

Each item on the list comes with a brief description of either the features of the library or a brief overview of what's changing in the package's updates.

tagged: symfony bundle spotlight easyloghandler ezmigration netgenlayouts sylius

Link: https://www.symfony.fi/entry/symfony-bundle-spotlight-easyloghandler-ez-migration-bundle-netgen-layouts-and-sylius

Stovepipe Systems:
Symfony Security Roles vs. Voters
Aug 22, 2016 @ 10:08:28

On the Stovepipe Systems blog author Iltar van der Berg has retuned with a continuation of his series on Symfony security basics with this new post covering voters and roles.

In my previous blog post I've explained the basics of authentication, authorization and how this is dealt with in Symfony. Due to the size of the post, I've left out several important topics such as roles and voters; Both an equally important part of authentication and authorization. A common misconception is that roles should be used to check permissions. In fact, they should definitely not be used to check permissions!

He goes on to explain where "roles" come into the process of authentication (not authorization) and how they describe something about the user of the system. With that defined he moves on to the "voters": functionality that "vote" on attributes related to the user/request/resource/etc. and return a pass or fail decision based on their logic. He explains why voters are probably more what most developers are looking for and some reasons to use them over roles. He then ends the post showing how to create your own custom voter and configure it into your application.

tagged: tutorial symfony authorization voter role introduction custom

Link: https://stovepipe.systems/post/symfony-security-roles-vs-voters