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

Alex Makdessi:
Diving into Symfony's DependencyInjection - Part 1: First steps with the container
Oct 10, 2018 @ 11:53:34

Alex Makdessi has a post on his Medium.com site kicking off a series of posts taking a deeper look into the Symfony DependencyInjection component. In this first part of the series he takes some of the "first steps" with the container.

this article, we’re going to dive into Symfony’s dependency injection component. We will use it from scratch, out of the Symfony framework, with the minimum of external dependencies. You can code along with me while reading this article, each steps will be detailed so you can easily follow.

He starts off the tutorial by creating a new project and including the DependencyInjection (DI) component via Composer (as well as symfony/var-dumper for debugging). He then starts in on the code showing how to make a ContainerBuilder instance to hold the object instance for reuse. With the container created, we now need something to use it. He creates a basic piece of functionality that works similar to the "voters" included with Symfony's security component to determine if a user has a certain role. He first creates this as a stand-alone tool but then refactors it so that the access manager and post voter objects are pulled from the dependency injection container rather than made manually.

tagged: symfony depdendencyinjection part1 series firststeps voter tutorial

Link: https://medium.com/manomano-tech/diving-into-symfonys-dependencyinjection-part-1-first-steps-with-the-container-2fad0593c052

Symfony Blog:
The SymfonyLive Paris 2019 website is online!
Oct 09, 2018 @ 11:09:32

On the Symfony blog they've posted an announcement about the launch of the SymfonyLive Paris 2019 website, the Symfony-focused event happening March 28th and 29th in Paris, France.

Last week, we announced the dates of the next edition of the French SymfonyLive conference, March 28-29. Today we're very pleased to announce that the conference website is now online! Early bird registration is open as well as the >Call For Papers. You can start submit your talk proposals (in French) for the conference. CFP will be open until December 17th (included). We encourage you to submit several talk proposals to increase your chances of selection.

[...] Early bird registration is open until December 17th (included). You can register for the 2 days of conference on March 28-29 for 239€ (breakfast, lunch, food for both days and your free conference t-shirt are included)! We organize pre-conference workshops on March 26-27, the workshops' topics will be announced soon, stay tuned!

If you're curious to see what kind of content has been presented in the past at SymfonyLive conferences, check out their YouTube channel. Otherwise, start getting those ideas submitted!

tagged: symfonyliveparis19 website release symfony conference callforpapers earlybird

Link: https://symfony.com/blog/the-symfonylive-paris-2019-website-is-online

Three Devs & A Maybe Podcast:
Running Symfony on AWS Lambda with Neal Brooks
Oct 08, 2018 @ 13:14:16

The Three Devs & A Maybe podcast, hosted by Michael Budd, Fraser Hart, Lewis Cains and Edd Mann, has posted their latest episode: Running Symfony on AWS Lambda with Neal Brooks

In this weeks episode we are lucky to be joined by Neal Brooks, a fellow developer of Edd’s at MyBuilder. We start off by discussing how he got into programming, QBasic and video driver shenanigans. From here, we move on to introduce his SymfonyLive London talk ‘Running Symfony on AWS Lambda’. We highlight what drew him to Lambda, and the new tooling that is making it easier to run PHP and frameworks (such as Symfony) on it. This leads us to cover his demo application, and explore handling assets using S3, database migrations and AWS resources using CloudFormation. Finally, we debate using catch-all gateway endpoints vs. dedicated gateway endpoints and Lambda performance.

Other topics mentioned include using a CDN with Symfony, the dittto/serverless-s3-assets library and the Mince Pie Challenge. You can listen to this latest episode either using the in-page audio player or by downloading the mp3 of the show directly. If you enjoy the episode, be sure to subscribe to their feed and follow them on Twitter for updates when new shows are released.

tagged: threedevsmaybe podcast episode symfony awslambda nealbrooks

Link: https://threedevsandamaybe.com/running-symfony-on-aws-lambda-with-neal-brooks/

Symfony Blog:
New in Symfony 4.2
Oct 05, 2018 @ 12:06:50

Over the past several weeks the Symfony project blog has released a series of posts detailing new features in the 4.2 release of the framework. Here's the current listing of those posts:

Each post includes a summary of the changes or additions and some example code and configuration showing it in use.

tagged: symfony framework feature component update addition list

Link: https://symfony.com/blog/

Symfony Blog:
Introducing Symfony Panther: a Browser Testing and Web Scraping Library for PHP
Sep 26, 2018 @ 12:24:02

Earlier this month, the Symfony blog made an announcement about a new browser testing and web scraping tool that's been released under the Symfony umbrella: Panther.

Since the very first version of Symfony 2, the framework provides a suite of convenient tools to create functional tests. They use the BrowserKit and DomCrawler components to simulate a web browser with a developer-friendly API.

The post starts with a "refresh" of the current WebTestCase helper functionality to create these functional tests. They also include an example of a repository class that stores/retrieves the news and a matching controller to handle the requests (and Twig templates for output). They then create a test using the WebTestCase functionality to get the index and ensure that some of the content is correct.

The tutorial then takes this same scenario and applies tests using the new Panther functionality. Where the WebTestCase uses a simulated browser internal to the framework, Panther uses an actual browser to run is tests using the Facebook PHP WebDriver library. They show the slight updates that would need to be made to the current test and the resulting output.

The tutorial goes on to provide other examples of tests for API requests and Javascript functionality for a Vue.js frontend. It wraps up mentioning some of the additional functionality Panther includes such as the ability to take screenshots and injecting Javascript into the pre-rendered page.

tagged: panther symfony tutorial introduction testing functional library

Link: https://symfony.com/blog/introducing-symfony-panther-a-browser-testing-and-web-scrapping-library-for-php#comment-form

Twilio Blog:
How to Send SMS Reminders from PHP Symfony Applications
Sep 25, 2018 @ 09:42:18

On the Twilio blog today Sylvan Ash has written up a tutorial showing how to send SMS reminders from a Symfony application as reminders of certain events.

If you have a booking system, making appointments such as massage or other therapist bookings, dental or medical appointments, etc., you’d probably like to remind the client about the booking they made on the day of the appointment. In some cases, you might also want to remind the person offering the service. In this tutorial, you'll learn how to send SMS reminders to clients of their upcoming massage appointments, at a designated time before the appointment, in a Symfony project using Twilio's SMS service.

The tutorial starts with a brief description of the setup and uses Composer to create a new Symfony project (the "Appointments" application). It then moves on to the models, defining the structure for the User and Appointment entities. It also shows how to make use of the seeding functionality to create several default users. Next up comes the Twilio integration: installing the SDK via Composer, defining the configuration and adding the client as a service.

With all of that set up, the final pieces are shown: the command to send the SMS messages via the Twilio service and the cron job to run it once a day at midnight.

tagged: symfony tutorial send sms application reminder appointment

Link: https://www.twilio.com/blog/sending-sms-reminders-with-symfony-php-framework

Jolicode.com:
How to Mix Security and Form with Symfony
Sep 21, 2018 @ 12:37:39

On the Jolicode.com blog, there's a tutorial they've posted showing how to "mix security and forms" in a Symfony application to show only certain form fields based on a user's roles.

In some applications, it could be required to disable some form fields depending on user’s roles.

In this article, we will see how to implement this feature thanks to a simple example: a blog engine.

For their example, they use a Symfony 4 application with the MakerBundle and create a basic blog with "article" entities and an "admin" entity for the user list. From there, the post includes the code needed to update the buildForm method in the ArticleType class to check the current user and be sure they have the "admin" role. To make this work, they also build out a SecurityExtension form extension class that performs the actual check. This is then hooked into the pre-submit event on the form to prevent other issues where an attacker might delete the "allowed" element and submit the data anyway. The post wraps up with an example of performing a similar check but hiding the field instead of just disabling it in the form.

tagged: security symfony symfony4 tutorial form builder admin check

Link: https://jolicode.com/blog/how-to-mix-security-and-form-with-symfony

Community News:
KnpUniversity is now SymfonyCasts
Sep 17, 2018 @ 10:44:36

An announcement has been posted by KnpUniversity today under the group's new name: SymfonyCasts.

If you look around the site today, you'll probably notice something different. KnpUniversity is now SymfonyCasts! And SymfonyCasts is the official online training system for Symfony. This is something we've been planning for awhile and we are beyond excited. Like, jumping-high-fives-someone-order-a-big-cake kind of excited! Woh.

If you're already a KnpU/SymfonyCasts user: we <3 you! And because of that, I want to explain exactly what this change means (and doesn't mean).

They start by answering the first questions most have about changes and if they acquired. They also talk about why they're making the change and how the focus will still remain on high-quality Symfony-related tutorials and videos. With them joining the Symfony family officially, though, it provides them with support to keep the lessons coming and the help they'll provide on the Symfony documentation as a part of the changes.

tagged: knpuniversity symfonycasts announcement symfony

Link: https://symfonycasts.com/blog/symfonycasts

TutsPlus.com:
Set Up Caching in PHP With the Symfony Cache Component
Sep 13, 2018 @ 11:14:08

On the TutsPlus.com site today they've posted a new tutorial spotlighting one of the components that makes up the Symfony framework, the Symfony Cache Component - and how you can use it to improve the performance of your applications.

Today, I'll show you the Symfony Cache component, an easy way to add caching to your PHP applications. This helps improve the overall performance of your application by reducing the page load time.

[...] In this article, we'll explore how you can unleash the power of the Symfony Cache component. As usual, we'll start with installation and configuration, and then we'll go on to explore a few real-world examples in the latter half of the article.

The tutorial starts with a few basic terms you'll need to be familiar with to use the component. From there it's straight into the installation and configuration of the component. Code is then included showing a more "real world" example of caching several different kinds of data, fetching it and setting expiration times. It then walks through each line of the code explaining how it works and more context about what's happening behind the scenes.

tagged: symfony cache component tutorial introduction

Link: https://code.tutsplus.com/tutorials/set-up-caching-in-php-with-the-symfony-cache-component--cms-31498

Colin O'Dell:
Avoid Unsupported Symfony Component Versions With This Composer Metapackage
Sep 12, 2018 @ 11:55:05

In a new post to his site Colin O'Dell has shared a Composer "metapackage" that can help you avoid unsupported Symfony component versions with the help of Composer's own internal version checking system.

Using symfony/symfony makes Composer install all Symfony Components in the same version. But when using the standalone packages, Composer might install dependencies in a different major version - for example, symfony/validator v2.8 is compatible with symfony/translation v3.0.

This is fine if you don't want to stick strictly to Symfony LTS versions, but it does mean that you could end up using versions of components which no longer receive security updates.

Rather than having to specifically define (and manage) the versions of package you want to install, you could opt to install his package that will do the hard work for you. It uses the "conflict" handling in the Composer configuration to limit version numbers on many of the popular Symfony packages and requires them to be greater than or equal to certain versions.

tagged: symfony component composer metapackage unsupported versions check

Link: https://www.colinodell.com/blog/201809/avoid-unsupported-symfony-component-versions-composer-metapackage