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

Tomas Votruba:
How to Manage Configuration in Symfony without Bundle, Extension, and Configuration?
Nov 30, 2018 @ 18:55:07

In this new post to his site Tomas Votruba shows how to configure a Symfony application without using the bundle or extension configurations.

Symfony Flex is moving towards of bundle-less applications. That doesn't mean you should create a monolith code in /src as fast as possible, but rather control everything via .yaml and .env files. It's takes few steps to remove extension and move to import of services.yaml.

But how would you approach a simple task as setup a account number parameter?

For those not familiar with "no-bundle applications" in Symfony, he starts with a link to the SymfonyCast course listing out the main points. Following this he covers what changes in the service registration and what changes in the configuration (with code examples). He then provides some options including keeping the extension, setting the parameter manually and binding the parameter, favoring the last two on his list as more maintainable.

tagged: tutorial symfony configuration bundle extension management

Link: https://www.tomasvotruba.cz/blog/2018/11/29/how-to-manage-configuration-in-symfony-without-bundle-extension-and-configuraiton/

Paul Jones:
Atlas ORM Integration with Symfony
Jul 31, 2018 @ 17:16:26

Paul Jones has a quick post covering the use of his Atlas.Orm package in a Symfony application, showing how to easily integrate the two.

Are you using Symfony 4? Do you want to use Atlas with it? We now have a Symfony bundle and Flex recipe that makes installation and integration a breeze. Two commands and one .env file edit, and you’re ready to go.

He includes the commands you'll need to get it installed and generate the skeleton mapper files from your database. Symfony then automatically injects the Atlas instance from the container (code example included). He ends the post linking to other resources about defining relationships, managing transactions and handling events with the Atlas.Orm package.

tagged: atlasorm integration symfony flex bundle package tutorial

Link: http://paul-m-jones.com/archives/6916

JoliCode Blog:
How to properly manage translations in Symfony?
Dec 14, 2017 @ 16: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

Symfony Finland:
Adding a GraphQL API to your Symfony Flex application
Dec 01, 2017 @ 17:49:05

On the Symfony Finland site there's a new post sharing a tutorial showing how to add a GraphQL API to your application with the help of the overblog/graphql-bundle bundle.

I've been using GraphQL for some API thingamajigs, and it's been working fine. Now with Symfony 4 out, I figured a write-up on how to use GraphQL with Symfony Flex could be useful for someone.

We'll expand on a previous demo app that I built. That app already uses Doctrine ORM as storage, so let's bridge that to a GraphQL API.

He starts by linking to "a quick read" about GraphQL for those not familiar and listing out the basic structure of the application he'll build out. Next comes the installation of the bundle and a debug bundle to help make it easier to locate errors. He then updates the application configuration to add routes and define the schema for the objects in the system. Using the GUI that comes with the debug package, he shows how to access the API and how to create a "resolver" that will relay the information back to the client from the GraphQL API request.

tagged: symfony graphql api symfonyflex tutorial bundle debug gui

Link: https://symfony.fi/entry/adding-a-graphql-api-to-your-symfony-flex-app

Symfony Finland:
State of GraphQL PHP libraries and Symfony integrations in 2017
Nov 15, 2017 @ 17: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

SitePoint PHP Blog:
Symfony Flex: Paving the Path to a Faster, Better Symfony
Oct 19, 2017 @ 18:16:52

On the SitePoint PHP Blog, there's a tutorial posted from editor Bruno Skvorc giving an introduction to Symfony Flex and how it is "paving the way" to a more performant future for Symfony.

Symfony Flex is a modern replacement for the Symfony Installer and not the name of the next Symfony version.

Internally, Symfony Flex is a Composer plugin that modifies the behavior of the require and update commands. When installing or updating dependencies in a Flex-enabled application, Symfony can perform tasks before and after the execution of Composer tasks.

The new Symfony will be called just Symfony 4, and while this tutorial will deal only with the Flex tool, it will mention some Symfony 4 upgrades as well.

The tutorial starts with some of the basics about Flex including its current development status and what kinds of things have changed from previous Symfony setups. It then walks you through the creation of a new Flex application including the bootstrapping of the application and the setup and use of application bundles.

tagged: symfony flex symfonyflex introduction tutorial bundle bootstrap

Link: https://www.sitepoint.com/symfony-flex-paving-path-faster-better-symfony/

SitePoint PHP Blog:
Introducing the Neo4j Symfony Bundle
Aug 07, 2017 @ 18:25:34

On the SitePoint PHP blog they've posted a tutorial from author Tobias Nyholm introducing the Neo4j bundle for Symfony-based application. This bundle provides functionality to work with Neo4j graph databases natively in the application.

There is no such thing as disconnected information, no matter where you look – people, events, places, things, documents, applications and the information about them is all heavily connected. As the volume of data grows, so does the number and dynamicity of its connections. And if you’ve tried in the past to store and query that highly connected, semi-structured data in any database, you probably experienced a lot of challenges.

The tutorial talks some about graph databases, how they work and what kind of data fits into them best. It also briefly covers the Cypher Query Language followed by an introduction to the bundle and what it has to offer. Code examples of putting the bundle to use for queries are provided including the models to handle the results, relationships and an example application you can use to start with a working example.

tagged: tutorial bundle symfony introduction neo4j database

Link: https://www.sitepoint.com/introducing-the-neo4j-symfony-bundle/

Fabien Potencier:
Symfony 4: A quick Demo
May 05, 2017 @ 14: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 @ 16: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 @ 14: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


Trending Topics: