News Feed
Jobs Feed
Sections




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

Rob Allen:
Injecting dependencies into your ZF2 controllers
April 23, 2014 @ 09:06:27

Rob Allen has a quick new post to his site showing you how to inject dependencies into controllers in a Zend Framework v2 based application.

When starting working with Zend Framework 2, it's common to copy the skeleton and put your controller definitions in module.config.php. The controllers keyword is picked up by the ControllerManager which is an instance of the ServiceManager which means that it creates the controller instance for you when the dispatcher needs it. As it's just a service manager, we configure it to inject the dependencies that the controller needs rather than having to go fishing for them later.

He shows how to write a "getControllerConfig" method to populate two items into the factory call for a "Blog" controller, blog mapper and content mapper classes. He also includes a reminder that ZF2 controllers have no constructor, so dependencies can be more easily injected and used directly in the class.

0 comments voice your opinion now!
dependency injection controller zendframework2 tutorial factory

Link: http://akrabat.com/zend-framework-2/injecting-dependencies-into-your-zf2-controllers/

Community News:
Packagist Latest Releases for 04.23.2014
April 23, 2014 @ 08:09:51

Recent releases from the Packagist:
0 comments voice your opinion now!




Master Zend Framework:
Howto Handle External Form Element Dependencies with FormElementManager
April 22, 2014 @ 11:58:07

The Master Zend Framework site has posted a tutorial wanting to help you understand external form element dependencies with help from FormElementManager.

Zend Framework 2, like all great PHP frameworks, provides thorough infrastructure for creating forms in your application. Whether that's form objects, form elements, fieldsets, validation groups or that they interact with so many other components in the Zend Framework 2 default libraries. But how do you handle external dependencies? [...] So what if you need a custom form element in your application, one which will render a list of articles from a database table? [...] In today's post, we're going to look at how to create such a custom element, extending the existing select element.

He walks you through the steps you'll need to make the custom element and hook it into the FormElementManager for correct use:

  • Create a New Form Element
  • Implement the getFormElementConfig Method
  • Create a New Form Object
  • Instantiate the Form Via the FormElementManager

Code is included for each step of the way so you can ensure you end up with a working example.

0 comments voice your opinion now!
external form manager element dependencies external tutorial

Link: http://www.masterzendframework.com/zend-form/handle-external-form-element-dependencies-with-formelementmanager

SitePoint PHP Blog:
Database Versioning with Ladder Migrations
April 22, 2014 @ 10:48:41

The SitePoint PHP blog has posted another tutorial looking at database versioning (see this postfocusing on Ladder migrations. Ladder is a simple PHP-based way to write migrations with rollbacks in a clear, easy to read format.

Version control systems are invaluable for tracking changes in your code, particularly when you're working in a team. However, most applications don't consist solely of application code. Managing changes to the database has always been a little more challenging, particularly when you're adding new features which require changes to the schema. [...] One solution is to move responsibility for creating and modifying the database schema into code, using migrations. That way, changes can be managed along with the rest of your application, and features we take for granted in version control - such as being able to compare versions and keep an audit trail - can be used for database changes.

He introduces the Ladder tool briefly, shows how to get it installed/configured and gets into writing a first simple migration. It creates a "users" table with two columns and comes with both "up" and "down" methods to make rollbacks easier. Ladder also provides functionality for database seeding, pre-populating the database tables with sample data either from hard-coded values or from a CVS file.

0 comments voice your opinion now!
database migration ladder versioning tutorial project

Link: http://www.sitepoint.com/database-versioning-ladder-migrations

HipHop VM Blog:
Compatibility Update
April 22, 2014 @ 09:16:38

The HipHop VM blog has a new post today with some updates around the compatibility work they're doing getting popular PHP projects to work 100% on the platform (and have all unit tests pass).

Earlier this year we set an ambitious goal of passing the PHPUnit test suites of 20 popular frameworks by the end of June; at the time, we were passing on only 6! With a huge amount of help from the community (especially our OpenAcademy students), we're proud to have hit this goal more than 2 months early, and we have more frameworks expected to reach 100% shortly.

Included in their list of projects/frameworks are things like Assetic, Composer, Doctrine2, Guzzle (v3), Laravel, Mockery and Monolog. Now that they've made significant strides to get the HHVM up to a greater level of compatibility, they're going to focus in on the issues list from GitHub to resolve problems there.

0 comments voice your opinion now!
compatibility update framework project unittest bugs issues

Link: http://hhvm.com/blog/4841/compatibility-update

Community News:
Packagist Latest Releases for 04.22.2014
April 22, 2014 @ 08:02:39

Recent releases from the Packagist:
0 comments voice your opinion now!



Community News:
Latest PECL Releases for 04.22.2014
April 22, 2014 @ 07:07:26

Latest PECL Releases:
  • opengl 0.8.0 - Initial PECL package release.

  • hrtime 0.4.3 - first public release

  • riak 1.1.5 Since 1.1.4 New: Object now allows contentEncoding, contentType, content and vTag to be set to NULL. Fixes issue 72: Riak HTTP stops working after update

  • swoole 1.7.0 - Fixed compile error.

  • protocolbuffers 0.2.6 Bumped up to 0.2.6 * fixed several compile warnings (thanks remi) [fixes] * (ExtensionRegistry) initialize class entry member when reallocating scheme.

0 comments voice your opinion now!



ServerGrove Blog:
Running Composer with HHVM, not so fast!
April 21, 2014 @ 12:46:02

On the ServerGrove blog today they share some interesting results when it comes to using Composer on a normal PHP install versus using it inside of a HHVM instance.

HHVM is an open-source virtual machine developed by Facebook and designed for executing programs written in Hack and PHP. It offers increased performance for PHP, most of the time. [...] Since Composer needs to perform some heavy computations in order to resolve the dependencies of a project, it makes sense to use HHVM. However, the heavy computations are mainly done when running composer update, or when the composer.lock file has not yet been generated so this is where you will see most of your gains in execution time.

With a bit more testing, this is shown to be true (about a 7 second difference). However, this is only on the "update". The "install" command actually takes longer inside of the HHVM instance, regardless of if the JIT (Just In Time) compiler is disabled or not.

0 comments voice your opinion now!
composer install update speed performance benchmark

Link: http://blog.servergrove.com/2014/04/17/running-composer-hhvm-fast

SitePoint PHP Blog:
Database Versioning with DBV
April 21, 2014 @ 11:11:45

In this new post to the SitePoint PHP blog today Wern Ancheta introduces you to a tool that can help with database versioning, DBV. DBV is a tool developed by Victor Stanciu and made available on GitHub.

It's good practice to always use a version control system in any of your projects. Be it a side-project in which you are the only developer, or a team project where five or more people are working on it together. But the idea of putting your database into version control isn't really that widespread. Often times we take the database for granted. But like the source files in our project, the database is constantly changing too. That's why we also need a way to track the changes that we have made and easily share it to other members of our team. In this article we will take a look at DBV, a database version control system written in PHP for MySQL databases so you need to have PHP and MySQL installed before you can use it, along with a web server like Apache or Nginx.

He steps you through the installation (via an installer and configuration through the "config.php" setup file. The system keeps track of lots of different changes including new tables, updated field descriptions, additional views, stored procedures and functions. He includes some screenshots of the UI and goes through the workflow of adding new tasks and syncing with a remote database server.

0 comments voice your opinion now!
database version tutorial dbv github

Link: http://www.sitepoint.com/database-versioning-dbv/


Community Events











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


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

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