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

Matthias Noback:
Decoupling your (event) system
August 26, 2014 @ 11:15:17

Matthias Noback has continued his look at event handling in PHP applications (well, Symfony-related ones at least) in his latest post. In this latest post he focuses more on abstracting out the event handling process and decoupling it from your application as much as possible.

You are creating a nice reusable package. Inside the package you want to use events to allow others to hook into your own code. You look at several event managers that are available. [...] Introducing this dependency is not without any problem: everybody who uses my/package in their project will also pull in the [event dispatcher] package, meaning they will now have yet another event dispatcher available in their project (a Laravel one, a Doctrine one, a Symfony one, etc.). This doesn't make sense, especially because event dispatchers all do (or can do) more or less the same thing.

As mentioned, he focuses in on the Symfony ecosystem and the event handlers commonly used there. He talks about some of the disadvantages of the Symfony EventDispatcher and how its interface can lead to code bloat due to it's verbosity (flexibility?). He talks about its violations of the Interface Segregation Principle and how he would structure the listener setup and handling if he was starting from scratch. To this end, he's created an adapter that wraps around an EventDispatcher interface and works with objects for the different kinds of events rather than the string names.

0 comments voice your opinion now!
decouple event manager dispatch handling symfony adapter object

Link: http://php-and-symfony.matthiasnoback.nl/2014/08/symfony2-decoupling-your-event-system/

Matthias Noback:
Symfony2 Event subsystems
August 25, 2014 @ 10:07:09

In his latest post Mathias Noback takes a look at the Symfony2 event subsystems and the answer to a common problem he's had with it in the past: circular references.

Recently I realized that some of the problems I encountered in the past could have been easily solved by what I'm about to explain in this post. [...] The problem is: having a complicated graph of service definitions and their dependencies, which causes a ServiceCircularReferenceException, saying 'Circular reference detected for service "...", path: "... -> ... -> ...".' Somewhere in the path of services that form the circle you then find the event_dispatcher service.

He shows the wrong way to solve the problem first by injecting a service container into the listener and using services directly from there. In his "entirely different and much better way" he shows a solution that removes dependencies on the main event dispatcher. He shows how to use the event subsystems to avoid this link and gives a more concrete example for domain-related events (with both code and config).

0 comments voice your opinion now!
symfony2 event subsystem listener dispatcher domain

Link: http://php-and-symfony.matthiasnoback.nl/2014/08/symfony2-event-subsystems/

Kevin Schroeder:
Creating a module in Magento 2
December 12, 2013 @ 09:15:40

Kevin Schroeder has posted a step-by-step guide to his site today about creating a module for Magento in the first of a series of posts about Magento.

I believe that one of the best ways to learn something is to write out what it is you are learning. This forces you to think through the concepts and determine how to explain them to others. In doing so you are forced to use terms that are familiar to describe this new thing. This helps to solidify the concepts in your own mind, making it easier to remember. But still, there are three caveats: Magento 2 is not out yet, I'm learning as I write and what I share is what I see (my interpretation).

He talks about some of the differences between Magento 1 and 2 including:

  • The lack of code pools
  • Discovery XML files are in a different location
  • A different parser for these XML files

With all of this configuration and location information covered, he gets into the actual module building. He makes a simple "Hello World" module with a module.xml, event.xml and an Observer that handles sending the text back to the waiting application.

0 comments voice your opinion now!
tutorial module magento2 module event observer

Link: http://www.eschrade.com/page/creating-a-module-in-magento-2/

Gonzalo Ayuso:
Playing with event dispatcher and Silex. Sending logs to a remote server.
October 22, 2013 @ 09:44:57

Gonzalo Ayuso as a new post today showing the results of some of his testing with the event dispatcher and Silex to send logs to a remote server.

Today I continue playing with event dispatcher and Silex. Now I want to send a detailed log of our Kernel events to a remote server. We can do it something similar with Monolog, but I want to implement one working example hacking a little bit the event dispatcher. Basically we're going to create one Logger class (implementing PSR-3 of course).

He includes the sample code defining a "Logger" class that takes whatever message sent to it and pushes it into a given socket resource. He also creates a provider for the logger to implement it in the example and registers it with the event dispatcher. He hooks it into the request, get controller, terminate and exception events. On the other side he uses React to make a basic server to listen on port 4000 for the incoming log data.

0 comments voice your opinion now!
silex event dispatcher remote server log logger psr3

Link: http://gonzalo123.com/2013/10/21/playing-with-event-dispatcher-and-silex-sending-logs-to-a-remote-server/

Gonzalo Ayuso:
Using the event dispatcher in a Silex application
October 14, 2013 @ 13:03:26

Gonzalo Ayuso has a new post today showing you how to use the Symfony event dispatcher in a Silex-based application. His example involves a simple image processing example.

Symfony has one component called The Event Dispatcher. This component is one implementation of Mediator pattern and it's widely used in modern frameworks, such as Symfony. Silex, as a part of Symfony, also uses this component and we can easily use it in our projects.

His example creates a Silex endpoint that creates an image with a given string. He notes that handling it all at once and then unlinking at the end of the request is one way to handle it. The other is to use the event dispatcher to add an event lister (as a closure) to happen "on terminate" to unlink the path it's been given.

0 comments voice your opinion now!
event dispatcher symfony2 silex image generate

Link: http://gonzalo123.com/2013/10/14/using-the-event-dispatcher-in-a-silex-application/

Community News:
PHP The Undiscovered Country (Event)
August 20, 2013 @ 09:10:25

At the end of this month (August 29th and 30th), there's a PHP event happening in San Francisco, CA that calls itself a "unique gathering of exceptional PHP developers from around the globe" - PHP: The Undiscovered Country. This two-day event includes speakers like:

  • Nate Abele
  • Graham Weldon
  • Garrett Woodworth
  • Dean Sofer

The sessions are covering things like the future of PHP application development, working with virtual teams, the HipHop VM and future-proofing your APIs. You can still pick up tickets for the event too. So far they've posted the Day 1 schedule to the site with more information (and other speakers) to come.

0 comments voice your opinion now!
pud13 undiscovered country engineyard event conference

Link: http://phpundiscovered.com

Liip Blog:
PHPUCEU (PHP Unconference Europe)
May 07, 2013 @ 11:16:54

On the Liip blog Lukas Smith has posted a wrapup of the PHPUCEU (PHP Unconference Europe) and some of the sessions that made up the two day event.

So this weekend I visited my hometown Berlin for the PHPUCEU. [...] This wasn't a "normal" conference. This was an unconference. As such attendees proposed talks they could give, but also talks that they would want to hear. Every morning every attendee would then have two votes for talks. The top voted talks would then be distributed across the 4 slots in the 3 available tracks. As such several of the sessions ended up being quite ad hoc with multiple people chipping in with what they new about the topic. What is also special about this event is that the sessions are just as long as the breaks to facilitate idea exchange about the session topics, but also about other topics. Overall I found this to be an absolutely thrilling experience.

Presentations chosen and made at this year's unconference included:

  • a talk about the PHPRC (PHP Content Repository)
  • "Clean Puppet"
  • Behavior Driven Development
  • Agile documentation
  • Hood.ie
  • Symfony2 REST API
  • NoSQL is Not the Answer

If you're interesting to see what the event was like, check out some of the photos they've posted to their site.

0 comments voice your opinion now!
phpuceu unconference europe wrapup event

Link: http://blog.liip.ch/archive/2013/05/06/phpuceu.html

Rob Allen:
Simple logging of ZF2 exceptions
April 25, 2013 @ 10:31:40

In this new post to his site Rob Allen shows you how to implement a simple logging method for catching exceptions in your Zend Framework 2 application.

I recently had a problem with a ZF2 based website where users were reporting seeing the error page displayed, but I couldn't reproduce in testing. To find this problem I decided to log every exception to a file so I could then go back and work out what was happening. In a standard ZF2 application, the easiest way to do this is to add a listener to the 'dispatch.error' event and log using ZendLog.

He uses an event listener to attach a service that contains a "logException" method. This method uses the ZendLog component to write out the error message to a local log file including a backtrace of where the issue occurred.

0 comments voice your opinion now!
simple logging exception handling service event listener tutorial

Link: http://akrabat.com/zend-framework-2/simple-logging-of-zf2-exceptions

Igor Wiedler:
Stateless Services
April 04, 2013 @ 10:41:50

Igor Wiedler has a recent post to his site about creating stateless services, specifically in the context of using a dependency injection container to manage the objects your application uses.

As more frameworks and libraries, particularly in the PHP world, move towards adopting the Dependency Injection pattern they are all faced with the problem of bootstrapping their application and constructing the object graph. In many cases this is solved by a Dependency Injection Container (DIC). Such a container manages the creation of all the things. The things it manages are services. Or are they?

He notes that, according to some of the principles of domain-driven design, "services" should be stateless - the results of calls to the service shouldn't alter it, it should only depend on the values passed in. He goes on to put this into the context of a DIC and gives an example of the "request service" (and how it violates the DDD principles of statelessness). He talks some about scopes (dependencies) and mutable services. He talks about methods to get around these issues with the "request" instance, ultimately coming to the conclusion that event listeners might be the way to go.

0 comments voice your opinion now!
stateless services dependency injection event listener request

Link: https://igor.io/2013/03/31/stateless-services.html

Community News:
Web & PHP Conference 2013
April 03, 2013 @ 09:16:45

The folks behind the Web & PHP Magazine have announced a new event they'll be putting on in San Jose, California in September of this year - the Web & PHP Conference. It's a four day conference featuring sessions, keynotes, an expo and "open knowledge sharing".

Web & PHP Magazine invites you to its first ever conference. This four-day event in September will immerse you in a world of continuously changing and evolving web technologies. Developers will get together and trade great ideas at Web & PHP Con. Whether your interests lay in core PHP, security, testing, architecture, frameworks or cloud, this is the place for you. Maybe HTML5, CSS3, responsive design, UX, mobile web or web-based mobile apps are where it's at for you. That's okay - we'll have loads. And if Agile, DevOps, Continuous Delivery or strategies are in your presentation bucket list, you won't be disappointed. Come and hear about latest technologies and methods, discuss your own project developments and find new solutions.

They've also opened their call for papers so you can submit your own ideas to present. There's a wide range of themes they're looking for at the event including things like:

  • Core PHP
  • Testing & Quality
  • HTML5 & CSS3
  • Mobile Web, Responsive Design
  • User Experience Design (UX)
  • E-Commerce, Magento, etc

Hurry and get your submissions in though - the deadline is April 26th!

0 comments voice your opinion now!
webandphpconference13 conference event sanjose september wap13

Link: http://webandphp.com/conference/webandphpcon2013


Community Events





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


configure application wordpress interview introduction list framework community api threedevsandamaybe project series release developer language code bugfix podcast library laravel

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