News Feed
Sections




News Archive
feed this:

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

PEAR Blog:
PEAR 1.9.5 is out
July 14, 2014 @ 11:09:24

The PEAR blog has posted a new announcement about the latest release of the PEAR PHP package manager, version 1.9.5.

The PEAR installer version 1.9.5 has been released today. The new version - three years after the last stable 1.9.4 and 2 weeks after the preview - is a bugfix only release. 13 bugs have been fixed.

Fixes include things dealing with broken Windows pathing and a change to report the correct php.ini setting for the installed XDebug.

0 comments voice your opinion now!
pear package manager release bugfix

Link: http://blog.pear.php.net/2014/07/12/pear-1-9-5/

SitePoint PHP Blog:
Building and Processing Forms in Symfony 2
June 06, 2014 @ 13:45:07

The SitePoint PHP blog has a new tutorial posted from author Daniel Sipos about form handling in Symfony2. More specifically, about creating them and handling the results from their submission. This is an introduction to the topic and gets into two examples, one focusing on a view implementation and the other using the form builder.

In this tutorial we will look at two examples of using forms in Symfony 2. In the the first, we will place form elements straight in the View file and then handle the form processing manually in the controller. In the second, we'll use the Symfony form system to declare forms in an object oriented way and have Symfony process and persist the values. We will be working on a simple installation of the Symfony framework.As you may know, it comes with a default bundle called AcmeDemoBundle and we will use that to illustrate working with forms.

In the first example he looks at "non-entity forms" and shows how to create the form from normal HTML elements in the view. The form is just a simple input field and a submit button. He includes the code you'll need to process the form submission too. In the second example he includes an example of how to create the same setup but using the Form Builder instead. It's also links it to a data object, making it simpler to save the submission results.

0 comments voice your opinion now!
symfony2 form processing view builder entity manager tutorial

Link: http://www.sitepoint.com/building-processing-forms-in-symfony-2

Hannes Magnusson:
I have a dream
May 26, 2014 @ 09:23:54

In his latest post Hannes Magnusson describes his "dream" about a future for PHP where things like upgrading and working with extensions would be simpler, faster and more manageable.

Today we will revolutionize PHP. We will make it easier to upgrade the things you care about. We will make it easier to not upgrade things you don't want to upgrade. We will make it easier to distribute your extensions. We will make it easier to release according to your own schedule. We will make it easier to add functionality. We will make it easier to work. Ok, today is a white lie here maybe... I haven't actually implemented this, but bare with me here for a second.

With the introduction and huge growth of Composer, the PEAR package manager is fading in popularity and is slowly being abandoned. Unfortunately, it's still the primary mechanism for deploying and installing PHP extensions (PECL packages). He talks about some of his recent experience reviving a package and issues he had around the use of the packaging manager. He proposes the creation of a new "pecl install" tool - a package manager dedicated to PHP extensions, decoupled from PEAR.

The manager would just install basic PHP then leave it up to you to pick which features you need from there. The idea is still in its early stages, but the idea has taken roots and plans are being worked through to see if this idea will work for the future of the language.

0 comments voice your opinion now!
pear pecl future language package manager extension

Link: http://bjori.blogspot.com/2014/05/i-have-dream.html

Matthias Noback:
Inject a repository instead of an entity manager
May 19, 2014 @ 11:04:30

Matthias Noback has made a recommendation in his latest post about using a repository rather than an entity manager in your classes to inject dependencies.

It appears that I didn't make myself clear while writing about entity managers and manager registries yesterday. People were quick to reply that instead you should inject entity repositories. However, I wasn't talking about entity repositories here. I was talking about classes that get an EntityManager injected because they want to call persist() or flush(). The point of my previous post was that in those cases you should inject the manager registry, because you don't know beforehand which entity manager manages the entities you are trying to persist. By injecting a manager registry you also make your code useful in contexts where another Doctrine persistence library is used.

He suggests that more classes actually need a repository and not an entity manager to work with necessary objects. He also points out how the use of an entity manager can sometimes violate the Law of Demeter. He includes some code showing a refactoring away from an entity manager and towards a repository. He also has an example of a custom repository class based on the domain logic object types. In addition he talks about repository interfaces, resetting closed entity managers and "criteria" objects.

0 comments voice your opinion now!
repository entity manager doctrine refactor example

Link: http://php-and-symfony.matthiasnoback.nl/2014/05/inject-a-repository-instead-of-an-entity-manager/

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

Wojciech Sznapka:
Injecting repositories to service in Symfony2
October 17, 2013 @ 11:45:54

Wojciech Sznapka has an interesting new post to his site today talking about injecting repositories into services in Symfony2-based applications. By injecting just a single repository instead of the entire EntityManager, you get a cleaner, more clear interface defined in the code.

It is generally a good idea to wrap business logic into services. Often, such services methods uses doctrine's repositories to operate on data storage. Injecting whole EntityManager service is very popular approach, but it isn't the most elegant way I could think of. EntityManager works only as a factory in that case and could lead to usage of other repositories, which might end up with too many responsibilities of given service.

He includes some code to illustrate his point - both a "services.xml" configuration of the related dependency injection container and a custom entity repository (defined in the config). He then shows how this repository (FooRepository) would be injected into the service (FooService) via constructor injection.

0 comments voice your opinion now!
symfony2 repository injection configuration tutorial entity manager

Link: http://blog.sznapka.pl/injecting-repositories-to-service-in-symfony2/

Reddit.com:
Composer still susceptible to remote code execution via MITM
October 03, 2013 @ 11:26:15

In this recent post to Reddit.com, a point is brought up about the popular PHP package manager, Composer about it being susceptible to a common attack called the "Man in the Middle". This issue on the project's Github repository talks more about it:

Composer runs code from HTTP sources without validating the source of the download or the code downloaded. As such, trivial man-in-the-middle attacks through any number of vectors (dns, networking, local server exploit, etc) will result in execution of code of an attackers choosing at the userlevel of the user running composer. (Typically a developer account)

Replace getcomposer.org for a given network perspective by replacing it with a malicious http instance (eg by changing the DNS locally, at the lan, at an isp or hosting provider dns resolver, or globally or equally easily by replacing a route to the legitimate server (eg arpspoof)) . The http server instance is configured to serve a malicious /composer.phar and a /version url that produces random data. When users run self-update, the malicious code will be downloaded and run as the user that is executing the self-update command.

As of yet some patches and ideas have been proposed to correct this issue, but it hasn't been resolved and is currently listed as a "blocker" on the project. One suggestion, signing packages, seems to be the front-runner in the current discussion, something that package managers for other languages have already implemented (like npm for Node.js and pip for Python).

0 comments voice your opinion now!
composer package manager remote code execution attack maninthemiddle mitm

Link: http://www.reddit.com/r/PHP/comments/1nkmw8/composer_still_susceptible_to_remote_code/

Dayle Rees:
Composer primer
April 15, 2013 @ 12:55:09

For those that might have heard about the Composer package management system for PHP but haven't had the time to get into it, you should definitely check out this great primer from Dayle Rees.

Composer is something special in the world of PHP. It has changed the way we handle application dependencies, and quelled the tears of many PHP developers. You see, in the olden days, when you wanted to build an application that relied on third party dependencies you would have to install them with PEAR or PECL. These two dependency managers both have a very limited set of outdated dependencies and have been a thorn in the side of PHP developers for a long time. [...] Enter composer, king of the package managers.

He jumps right in and gets into the configuration (the composer.json file) and using it to describe the package. He shows how to set up "required" resources complete with version number information. There's a bit about setting up autoloading and classmaps too. He then moves on to getting the tool installed and using the composer.json definition to load in needed packages (and development ones if needed).

0 comments voice your opinion now!
composer package manager primer configuration usage

Link: http://daylerees.com/composer-primer

MaltBlue.com:
Zend Framework 2 Event Manager - A Gentle Introduction
January 15, 2013 @ 13:19:50

Matthew Setter has a new post to his site for those wanting to take their first steps into Zend Framework 2. In it, he gives a gentle introduction to the Event Manager part of the framework - what its role is and how to customize it to your needs.

Enjoying the introduction to Zend Framework 2? I hope so. In part one of the series, we looked at Dependency Injection, otherwise know as the Inversion of Control principle. Then, in part two, we looked at Modules and the ModuleManager, the next key aspects. In this part, we started to work through what they are and stepped through how to build one from scratch; along with some pointers for taking them further. In this, the 3rd of 4 parts, I'm taking you through the next key aspect of the framework - the EventManager.

He starts with a graphic showing its overall functionality - an implementation of the Observer design pattern - and a general description of its goal (basically, execute code when actions are triggered). He talks about its implementation of aspect oriented programming and its event-driven architecture. Then he gets into some code-based examples: checking a query parameter on a dispatched request and logging form data before and after validation.

0 comments voice your opinion now!
zendframework2 event manager introduction tutorial


Jurian Sluiman:
Using Zend Framework service managers in your application
October 03, 2012 @ 08:52:39

Jurian Sluiman has a new post to his site showing how to use the service managers in your Zend Framework v2 applications.

Zend Framework 2 uses a ServiceManager component (in short, SM) to easily apply inversion of control. I notice there are good resources about the background of service managers (I recommend this blog post from Evan or this post from Reese Wilson) but many people still have problems to tune the SM to their needs. In this post I will try to explain the reason why the framework uses multiple service managers and how you can use these.

He talks about the different service managers that are available in the framework, why they're used, how they relate to the service locator and how you can define/fetch your own services in them. He includes some basic configuration code and compares the behavior of the root service manager to the others (application services, controllers, view helpers, etc).

0 comments voice your opinion now!
zendframework2 service manager tutorial introduction



Community Events





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


developer opinion testing release refactor language wordpress install podcast introduction unittest community series configure threedevsandamaybe laravel framework list interview code

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