News Feed
Jobs Feed
Sections




News Archive
feed this:

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

SitePoint PHP Blog:
Understanding Symfony Bundle Configuration and Service Container
February 04, 2014 @ 10:46:03

The SitePoint PHP blog has a post today for those that may be new to the Symfony framework or just wanting to get into it and having trouble understanding bundle configuration. In this new post Carl Vuorinen walks you through this process, combining an example bundle with its configuration.

In this post we'll cover different ways on how to configure Bundles in Symfony2 and how the dependency injection container works with the configuration. The Bundle configuration and Symfony dependency injection container (also known as service container) can be difficult concepts to grasp when first starting development with Symfony2, especially if dependency injection is not a familiar concept beforehand. [...] I am used to working with YAML because I think it's more readable than XML, but you do get the benefit of schema validation when using XML.

He briefly introduces the concepts behind "bundles" in Symfony and two ways to create one - either via the generator on the command line or manually. He also shows two ways to get a bundle's configuration loaded. There's the "easy way", configuring it inside the main "confix.yml", or the slightly harder way of adding a configuration file inside the bundle structure itself and using the "get" method to grab the values manually. With the location(s) of the configuration defined, he gets into the contents of the file and its structure. Finally, he shows the complete example, an "ExampleBundle" with a "greet" method that accepts the configuration value from the "cvuorinen_example.greeter" setting.

0 comments voice your opinion now!
symfony bundle configuration container service tutorial introduction

Link: http://www.sitepoint.com/understanding-symfony-bundle-configuration-service-container

Matthias Noback:
Symfony2 Add a global option to console commands and generate a PID file
November 26, 2013 @ 14:06:11

Cal Evans has pointed out a post by Matthias Noback related to Cal's "Signaling PHP" book and an idea presented in one of the appendices - working with PID files as a global option. Mattias writes:

Recently I read the book Signaling PHP by Cal Evans. It's a short book, yet very affordable and it learned me a couple of things. First of all it explains about how you can "capture" a Ctrl+C on your long-running command and do some necessary cleanup work before actually terminating the application. In the appendix it also mentioned the interesting concept of a PID file. [...] In Appendix A of "Signaling PHP", Cal writes about a way to extend a Symfony command to automatically create such a PID file before executing its task, and to delete this file afterwards.

Mattias shares what he calls a "hack" to make it happen globally - using the eventing system built into the Symfony Console functionality and the "console.command" event. He creates a bundle to help with the reading/writing of the PID file and shows how to implement it as a part of the event handling. He does point out one problem with this method (that the "input" object isn't available) so he works around it with the "ArgvInput" component and some manual handling to grab the PID file location provided.

0 comments voice your opinion now!
symfony2 console option command pid file tutorial bundle

Link: http://php-and-symfony.matthiasnoback.nl/2013/11/symfony2-add-a-global-option-to-console-commands-and-generate-pid-file/

Lukas Smith:
What is needed to REST in Symfony2
May 06, 2013 @ 10:24:05

Lukas Smith has a new post to his site that asks the question "what's needed to REST in Symfony 2?" In it he talks about some of the current issues surrounding REST support in Symfony (bundles) and a "call to arms" to create something better.

I think we already have quite a nice toolchain for REST in Symfony2 with Bundles like FOSRestBundle, JMSSerializerBundle, NelmioApiDocBundle, FSCHateoasBundle and HautelookTemplatedUriBundle. What is great about these Bundles is that they are all nicely integrated with each other. But there are still some limitations which should be addressed.

Some of the still outstanding issues he points out include issues with content-type and routing, dynamic content in the NelmioApi bundle, Behat context testing, JSONP support and more. He suggests gathering together a product backlog of these items and possibly making a kickstarter to fund its development.

0 comments voice your opinion now!
rest api symfony2 webservice bundle missing features

Link: http://pooteeweet.org/blog/2221

William Durand:
REST APIs with Symfony2 The Right Way
August 02, 2012 @ 12:03:24

In this new post to his site William Durand looks at creating a RESTful API with the help of the Symfony2 framework.

Designing a REST API is not easy. No, really! If you want to design an API the right way, you have to think a lot about everything, and either to be pragmatic or to be an API terrorist. It's not just about GET, POST, PUT, and DELETE. In real life, you have relations between resources, the need to move a resource somewhere else (think about a tree), or you may want to set a specific value to a resource. This article will sum up everything I learnt by building different APIs, and how I used Symfony2, the FOSRestBundle, the NelmioApiDocBundle, and Propel.

It's a long post and covers things very completely with plenty of code samples and descriptions showing you how to use these pieces to make the API. He covers the major HTTP verbs (GET, POST, PUT & DELETE) as well as one of the lesser used ones - PATCH. He also looks at the HATEOAS documentation method and a brief look at using a simple client to do some testing.

0 comments voice your opinion now!
symfony2 api rest tutorial bundle patch


NetTuts.com:
The Essentials of Creating Laravel Bundles
July 18, 2012 @ 10:03:34

Continuing in their series looking at using the Laravel PHP framework, NetTuts.com has posted this latest article focusing on the creation of "bundles" for use in Laravel-based applications.

The Laravel PHP framework offers its bundles system to allow developers to redistribute useful packages of code, or to organize applications into several "bundles" of smaller applications. In this tutorial, we will learn the ins and outs of creating and distributing bundles from scratch. A Laravel bundle has access to all of the features that the framework offers to its host application, including routing, migrations, tests, views and numerous other useful features.

They start with the "when to create a bundle?" question, a combination of the answers to four other questions (like "could others use it?" or "should this just be a library?"). From there they get into the actual code, showing you how to create a basic bundle that works with the Gravatar service to pull an image for a given email address. Also included is a sample unit test, how to implement it in the controller and a sample view that interacts with it to make it all work.

0 comments voice your opinion now!
laravel framework bundle tutorial gravatar


Lineke Kerckhoffs-Willems' Blog:
How to use the Symfony2 SonataAdminBundle
May 23, 2012 @ 10:33:05

In this recent post to her blog Lineke Kerckhoffs-Willems talks about some recent Symfony2 development she's been doing and some of the trials she's come across when trying to implement the SonataAdminBundle to build on their pre-existing Doctrine2 entities.

I have been doing a lot of Symfony2 development lately for our project ProTalk and one of the things we needed was a backend for our database. This should be a fairly simple backend to start with, just an easy way to get data into the database. So I thought I would use the SonataAdminBundle to easy generate this backend based on the doctrine2 entities that we already have. Eventually, I got it working, but it took me some time to find out exactly how, so I thought I'd share my experiences.

Based on some information she found in this other post, she was able to configure and connect it to a "tag" entity. To make it work, however, she needed an empty controller to move forward.

0 comments voice your opinion now!
symfony2 sonata bundle sonataadminbundle tutorial install configure


Stefan Koopmanschap's Blog:
Using git-svn with Symfony2's deps installer
April 03, 2012 @ 10:52:52

In this latest post to his blog Stefan Koopmanschap shares a quick tip about using the git-svn tool with the dependency installer in a Symfony2-based application.

I work a lot with Symfony2's deps file for installing 3rd party bundles into my project (yeah I know, I should be using Composer, right?). This works really well when working with pure Git. However, when you're not using Git on it's own but instead use git-svn, you may run into some issues when issuing git svn dcommit,

One issue relates to a "Failed to read object" error that could come up during the push. His solution involves a few steps (manual ones) to prepare those bundle directories and make it easier to push the rest of your changes. He also includes a few links to other resources that he found around the same topic.

0 comments voice your opinion now!
symfony2 bundle dependencies gitsvn versioncontrol dvcs


Henrik Bjørnskov' Blog:
Symfony2 Quick tip for your security configuration
December 27, 2011 @ 08:40:45

Henrik Bjørnskov has a quick new post with a security tip for those using the Symfony2 framework in its configuration.

Earlier when playing around with the Security component and SecurityBundle i found that for all paths you can specify a route name and the component will match it when check for the request paths.

Setting this up in your configuration gives you more control over the paths that are matched as well as more flexibility in defining them. He includes a note about a change you might have to make to the SecurityBundle's code to get the "check_path" part working correctly. You can find out more about the SecurityBundle's integration in this blog post from Pablo Bandin.

0 comments voice your opinion now!
symfony2 framework security bundle checkpath path


Leasewebs Labs:
Painless (well, less painful) migration to Symfony2
December 23, 2011 @ 11:02:12

Stefan Koopmanschap has written up an article on the Leaseweblabs.com blog about migrating a Symfony 1 application to Symfony2 in a (slightly) less painful way that making the move all at once.

It is much easier to do a gradual migration. Start with one part of your application, and bit by bit migrate your logic and application. The traditional way of doing such migrations is to create a new project and have parallel development on the old and the new version of the application. The problem with this, though, is that when you make a change to your old application, you have to make the same change in the new codebase, essentially doubling the amount of work for each feature you need to implement. [...] You could wrap your old application into your Symfony2 application, and have different parts of your application be handled by different versions of your codebase.

With the help of a bundle he created, IngewikkeldWrapperBundle that handles the rerouting of your requests based on where the requested resource exists (in the Symfony 1 or 2 codebase).

0 comments voice your opinion now!
symfony2 migrate codebase bundle painless


Dzone.com:
Two Symfony2 Bundle Repositories
December 22, 2011 @ 12:05:43

On DZone.com John Esposito has a new post sharing two Symfony2 bundle repositories you can look to to improve your development experience with the framework - KnpBundles and Symfohub.

If you're using Symfony2, you already know that the framework uses 'bundles', the equivalent of plugins, if the core counted as a plugin too. (The official documentation calls bundles 'first-class citizens' in Symfony2.) So far so great idea, but an ecosystem depends on a community, and a community needs some kind of organization. So how is the Symfony2 bundle community organized, and how do you find existing third-party bundles?

KnpBundles provides a larger resource than Symfohub, but both have handy features to help you find what you're looking for - filtering, search recommendations and rankings.

0 comments voice your opinion now!
symfony2 bundle repository knpbundles symfohub



Community Events











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


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

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework