News Feed
Jobs Feed

News Archive
feed this:

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

ServerGrove Blog:
Symfony2 components overview Process
April 18, 2014 @ 12:41:41

The ServerGrove blog has posted their latest Symfony2 component spotlight, this time focusing on the Process component.

The Symfony2 Process component, allows us to execute commands in sub-processes. [...] The Process component provides an object-oriented abstraction on top of proc_* functions to execute independent processes from PHP.

As with the other posts in the series, they walk you through the installations via Composer and some examples of its use. The post also shows the use of exit codes, working with long running processes and how to execute PHP code in the command. They also briefly look "under the hood" at how the component does what it does (on top of the proc_* functions).

0 comments voice your opinion now!
symfony2 component process external command overview

Routing Overview & Basics in Symfony 2
April 17, 2014 @ 12:10:12

If you're relatively new to using the Symfony2 framework, you might be wondering about some of the things happening during requests to your application. One of these things is the routing and handling of each request. In this new post from they introduce you to the foundations of Symfony2 routing in a screencast.

In the last video, I said we'd take a look at controllers next, but I actually feel it may be easier to learn the framework in a slightly different order. Instead, we're going to learn about the basics of Symfony 2 routing, to give our applications clean and pretty URLs and make it easy to manage our applications URLs and links. We're not going to get too detailed, as Symfony's routing can do quite a bit, but we'll at least cover what we need to know by keeping it straight and to the point.

The screencast is a bit less than 10 minutes long and provides an overview of the routing, how it interacts with bundles and controllers. There's also a bit about using annotations to help define routing information directly in the controller.

0 comments voice your opinion now!
routing basics symfony2 introduction screencast demo


ServerGrove Blog:
Symfony2 components overview ExpressionLanguage
April 10, 2014 @ 12:09:23

The ServerGrove blog has posted the latest in their series focusing on various components in the Symfony2 framework. This latest post looks at the ExpressionLanguage component, functionality that allows you to execute "expressions" easily.

This is the 10th post in our series on Symfony2 components and we will cover the latest component added to Symfony: the ExpressionLanguage component. This component was added in version 2.4 and provides a way to have dynamic aspects in static configurations. For example, it can be used to evaluate expressions in configuration files, create a DSL ,or build a business rules engine.

The tutorial shows you how to get it installed (via Composer) and provides a simple "before" and "after" example, the first using eval and the second using ExpressionEngine to reproduce the same effect. They note that the evaluation of the expression isn't the same thing as compiling it and re-execution will always take the same amount of time. The post then talks about some of the syntax, functions and caching features of the component. It dives a little bit deeper and looks at some of the internals of the component as well.

0 comments voice your opinion now!
symfony2 component expressionengine overview example


ServerGrove Blog:
Deployment of Symfony2 applications with Ansible
April 02, 2014 @ 10:41:54

The ServerGrove blog has a new post today showing you how to deploy Symfony2 applications using Ansible, an automation tool that uses "playbooks" to define steps.

Ansible is a powerful automation engine that simplifies deploying systems and apps. Its popularity has been rising rapidly as developers and system administrators look for simpler ways to manage servers and deploy applications. The selling points of Ansible are: simplicity, agentless and extensible.

ServerGrove, traditionally a Capistrano/Capifony user, decided to give Ansible a try. They include the steps to go through to get the correct environment set up and how to execute commands on the remote servers. There's also an example of a sample task that updates packages on the remote server, moves a config file into place and restarts Apache. With this foundation, they get into the actual Symfony2 deployment, sharing their custom role that sets up the directory, clones the Git repository, runs Composer and executes an Assetic dump.

0 comments voice your opinion now!
ansible tutorial introduction automation symfony2 deploy


Symfony - Project Tamed
March 27, 2014 @ 09:44:29

On the ClearCode blog today there's a new post for the Synfomy2 users out there with some recommendations about taming your project to make it more manageable and maintainable.

When managing projects based on Symfony2, from the technical side, it is a good idea to establish a set of rules for the project. If you haven't established and implemented such rules yet, then they should be created as soon as possible. Why? Well, no matter how many people are working on the project, the code needs to look like it was written by one person. [...] Symfony documentation doesn't specifically focus on this issue, and the bundles that are written by the community have their own set of rules. [...] Learning from mistakes as you go along cannot only be costly, but also time consuming. It is good to have a starting point, something that at least has worked for someone else. This is how the idea to share the guidelines on the Taming Symfony Project came about.

They list out some of the guidelines of the project centered around various aspects of the implementation and the directory structure. They also talk about standards around the use of Doctrine, Twig and Services.

0 comments voice your opinion now!
symfony2 framework project structure recommendations


ServerGrove Blog:
Symfony2 components overview Finder
March 26, 2014 @ 12:12:36

The ServerGrove blog has posted the latest in their series focusing in on the components in the Symfony2 framework. In this new post they look at the Finder component, used to locate files or directories in your project.

This is the 9th post in this series about the Symfony2 components. Today's post covers one of the most popular PHP packages: the Finder component. According to Packagist it is the 14th most used PHP package, and the 3rd Symfony2 component, only after the EventDispatcher and Console ones.

They walk you through the installation (via Composer) and show some code examples of it in use, including the output. They list out some of the options you can specify when using the component and go "under the hood" to detail the interfaces, adapters and objects that make it all work. There's also a list of other applications (outside of the Symfony2 framework) that use it as an independent package.

0 comments voice your opinion now!
symfony2 component finder tutorial


Matthias Noback:
Test Symfony2 commands using the Process component and asynchronous assertions
March 24, 2014 @ 10:49:13

Matthias Noback has a new post today showing you how to test Symfony2 commands that use the Process component. More specifically, his tests revolve around the ones that use asynchronous assertions in the testing to remove weird behaviors that could be caused by multiple processes running them simultaneously.

Usually you would test a console command using the ConsoleTester class as described in the official Symfony documentation. But we can not use it in this case. We need to isolate the process in order for pcntl_fork() to work correctly, otherwise the PHPUnit test runner itself will be forked too, which will have the effect of running all the following unit tests twice (which can have very strange effects on the test results).

He shows how to use the Process component to start up a new process (the daemon) and check that the PID file exists. He includes an example of a "probe" to determine what processes are running and preventing them from stepping on each other.

0 comments voice your opinion now!
symfony2 command process component asynchronous assertion unittest phpunit


Joshua Thijssen:
Dynamic form modification in Symfony2
March 20, 2014 @ 09:42:16

Joshua Thijssen has a new post to his site looking at a way to dynamically modify forms in a Symfony2-based application. Form handling can be a bit tricky (especially with more complex elements), and modifying them on the fly can be even more difficult.

Sometimes (or actually, a lot of the time), handling forms will go beyond the basics. And even though symfony2 gives you out-of-the-box a really clean way of creating forms, it sometimes just isn't enough. Fortunately, you are not alone in writing forms, and many posts exists with information on how to handle complex forms. In this post, I will try and demonstrate how to create a dynamic form where you can select a city based on the chosen province.

His example lets the user pick their province and then populates the other select with cities in that area. He includes the code for the form to create these two selects and how to pull out the list of provinces to populate the first. He goes through each part of the example code explaining the methods, what they're doing and how a pre-submit event can be used to populate the second list.

0 comments voice your opinion now!
dynamic form value modification symfony2 tutorial


ServerGrove Blog:
Symfony2 components overview Translation
March 18, 2014 @ 16:37:40

The ServerGrove blog has posted their latest up-close look at the various components that make up the Symfony2 framework. In their latest post, they focus in on the Translator component.

Modern applications need to be internationalized and localized to be able to reach people from all over the world. Internationalization - aka i18n - is the process of designing a software application so that it can be adapted to various languages and regions without engineering changes. Localization - aka l10n - is the process of adapting internationalized software for a specific region or language by adding locale-specific components such as dates or currency. The Translation component provides different tools to get your application internationalized, but not localized.

The post covers the three main parts of the component - Catalogues, Loaders and Dumpers - and includes a simple example of creating the object, adding resources and calling "trans" to translate. There's also an example of using the YAML file loader to include the translated strings. There's also mentions of pluralization, translation "domains" and custom loaders.

0 comments voice your opinion now!
symfony2 component overview translation tutorial


ServerGrove Blog:
Symfony2 components overview Templating
March 14, 2014 @ 10:11:46

The folks at ServerGrove have posted the latest in their series focusing in on various components of the Symfony2 framework. This time they look at the Templating component, useful for working with the output from the application, web or otherwise.

The Templating component provides an engine-agnostic infrastructure to load template files and render them using the input variables. Although the component provides methods for creating template systems, we are going to focus on how to integrate third-party template engines like Twig and Smarty, and how to use the right engine based on the templates file extension.

The post talks about typical PHP output (with escaping) and shows the difference between a call with htmlspecialchars and the use of the Template component to render a view. An example is also included showing the use of other template engines into the template object, plugged directly into the "render" method. The end of the post also briefly mentions an alternative template language, Plates, an option similar to Twig but uses native PHP rather than tags and placeholders.

0 comments voice your opinion now!
symfony2 component overview templating tutorial


Community Events

Don't see your event here?
Let us know!

example package hhvm podcast overview symfony2 application release unittest opinion install hack code language introduction facebook security component framework composer

All content copyright, 2014 :: - Powered by the Solar PHP Framework