Skip to content

web - Zend Framework 2 ServiceManager

english I found a great summary about available service manager features.

Invokables An invokable is simply a fully qualified class name, provided to the SM as a string. When requested, it will simply be instantiated with new $invokableClass();. [...] Factories A factory is either a PHP callable, an object, or the fully qualified class name of a class implementing Zend\ServiceManager\FactoryInterface. Factories are used to perform any setup or dependency injection required for the object being requested. [...] Aliases An alias simply points one service name to another and they can be recursive. This may seem pointless at first, but aliases actually play a very important role in a modular environment. [...] Initializers An initializer is either a closure, an object, or the fully qualified class name of a class implementing Zend\ServiceManager\InitilizerInterface. Any object pulled from a service manager is ran through the registered initializers which can perform additional initialization tasks. [...] Configuration Classes A configuration class that implements Zend\ServiceManager\ConfigInterface. Config classes simply know how to configure an instance of the SM, potentially setting several factories, invokables, initializers, etc. [...] Shared Services Anything placed in the SM can be either shared or not shared. If shared, the SM will create an instance of the requested service object the first time it is requested, and on subsequent requests, return that same exact instance. If shared is set to false for a service, the service manager will create a new service. By default, all services are set to shared. [...] Abstract Factories If a SM is asked for a service which it cannot locate, it will then query the registered abstract factories to see if any of them are able to create the requested object. An abstract factory is either a fully qualified class name as a string or instance of an object that implements Zend\ServiceManager\AbstractFactoryInterface. [...] Peering Service Managers The service manger introduces a concept of peering. Each service manager can have “peers”, or rather, a stack of one or more other service managers which can also be used when a service is pulled from the SM. [...]
source Quick start service managers in your application Great survey, isn't it?


Auf der Suche nach einer Erklärung über das Wort "invokable" fand ich einen Eintrag, der eine Übersicht über vorhandene Service Manager Funktionen gab. Um das Wissen auch in meiner Muttersprache weiter zugeben, folgt anschließend die Übersetzung der weitern oben zitierten, englischen Zeilen.

Invokables Ein "invokable" ist ein vollqualifizierter Klassenname, welcher dem ServiceManager als Zeichenkette zur Verfügung bereitgestellt wird. Falls verlangt, wird eine neue Instanz dieser Klasse mit Hilfe von "new $invokableClass();" erzeugt. [...] Factories Eine "factory" (Fabrik) kann eine PHP abrufbare, ein Object, oder ein vollqualifizierter Klassenname einer Klasse sein, welche die Schnittstelle "Zend\ServiceManager\FactoryInterface" implementiert. Fabriken werden genutzt um jegliche Einrichtung (Setup) oder Abhängigkeitsinjektion (dependency injection) für die Instanziierung einer Klasse zu realisieren und zentralisieren. [...] Aliases Eine "alias" (alternative Bezeichnung) zeigt einfach auf einen anderen Dienst und kann rekursiv sein. Wirken Aliases am Anfang als unnütz, können sie bei einer modularen Umgebung eine große Rolle spielen. [...] Initializers Ein "initializer" (Initialisierungsprogramm) ist entweder ein Closure, ein Object oder ein vollqualifizierter Klassenname einer Klasse, welche die Schnitstelle "Zend\ServiceManager\InitilizerInterface" implementiert. Ein Objekt, welches vom ServiceManager kommt, durchläuft die registrierten Initialisierungsprogramme, welche weitere Initialisierungsaufgaben vornehmen können. [...] Configuration Classes Eine "configuration class" (Einstellungsklasse) implementiert die Schnittstelle "Zend\ServiceManager\ConfigInterface". Einstellungsklassen wissen, wie sie den ServiceManager konfigurieren, setzen etwaig Fabriken, "invokables", Initialisierungsprogramme usw. [...] Shared Services Alles, was in den ServiceManager vorhanden ist, kann geteilt werden. Wenn ein Dienst geteilt ist, wir der ServiceManager eine Instanz des gewünschten Objects erstellen und zurückgeben. Wurde bereits eine Instanz erstellt, gibt der ServiceManager diese Instanz bei einer enreuten Anfrage wiederrum zurück. Falls ein Dienst nicht geteilt werden darf, erstellt der ServiceManager bei jeder Nachfrage eine neue Instanz der Klasse. Von Haus aus sind Dienste geteilt. [...] Abstract Factories Falls ein ServiceManager nach einem Dienst gefragt wird, den er nicht finden kann, wird er alle vorhandenen, abstrakten Fabriken anfragen um das gewünschte Objekt zu erstellen. Eine abstrakte Fabrik ist entweder ein vollqualifizierter Klassenname oder eine Instanz eines Objekts, welches die Schnittstelle "Zend\ServiceManager\AbstractFactoryInterface" implementiert. [...] Peering Service Managers Der ServiceManager hat das Konzept des "peering" (Späherei/Umherschauens/Gleichrangigkeit) eingeführt. Jeder ServiceManager kann einen, oder eine Sammlung von, "Gleichgestellten"/"Spähern" ServiceManagern besitzen, welche ebenfalls genutzt werden können, wenn ein Dienst vom ServiceManager angefordert wird. [...]

Quelle Schnellstart Service Managers in deiner Anwendung

Übersetzungsfehler korrigiere ich gern.

Translate to de es fr it pt ja

note - zend framework 2 - 120924

I am currently playing around with the new zend framework 2. It feels so fresh to work with. Less magic and hidden logic and especially the new way of working with forms feels so useful. I am pleased to have a small project in the pipe to work with it.

Translate to de es fr it pt ja

web - zend framework 2 released - php

Finally, the Zend Framework 2 is released. Thank you Team around Mr. Phinney, it was a joy to talk or read with you via irc (the new channel is now the old one called "#zftalk").

For the Zend Framework 1 Users, a lot of Singletons are gone (good bless this move). The new magic number two also simplifies the creation and usage of modules. Hopefully there will exist a garden full of lovely plugins and modules out there. If you want to take a look, try to read something about "Dependency Injection" and "EventManager" before.

Zend Framework 1 should be supported for 12 or 24 months and a migration howto should be out there very soon.

I'm very happy the framework is out since it was already a joy to work with the beta's (formally known as alphas ;-)) and of course learn all the new concepts.


Translate to de es fr it pt ja

web - Zend Framework 2.0.0beta3 Released!

The Zend Framework community is pleased to announce the immediate availability of Zend Framework 2.0.0beta3. Packages and installation instructions are available at: [...] Featured components and functionality of 2.0.0beta3 include:
Refactored Config component All configuration readers have been moved under the Zend\Config\Reader namespace A Zend\Config\Factory has been added to simplify retrieving a config object from a config file Supported configuration formats now support importing additional configuration files All constant processing has been moved to a Zend\Config\Processor namespace, and expanded to be more powerful Work was provided by Ben Scholzen, Artur Bodera, Enrico Zimuel, and Evan Coury
New View layer New subcomponents include Zend\View\Model, Zend\View\Resolver, Zend\View\Renderer, and Zend\View\Strategy The old Zend_View class has been moved to Zend\View\Renderer\PhpRenderer, and rewritten to move most of its responsibilities into collaborators, greatly simplifying its design while simultaneously giving it more capabilities. A new class, Zend\View\View, allows selecting rendering strategies on a per-template basis, based on arbitrary criteria, and optionally injecting rendering results into a Response object MVC integration streamlines common use cases, including View Model creation and injection, 404 and error page creation, and more. Work was provided by Matthew Weier O'Phinney, with copious feedback from Rob Allen. Rewritten DB layer New architecture features low-level drivers, which also provide access to the PHP resource being consumed; adapters, which provide basic abstraction for common CRUD operations; new SQL abstraction layer, with full predicate support; abstraction for ResultSet's, with the ability to cast rows to specific object types; abstraction for SQL metadata; and a revised Table and Row Data Gateway. Work was provided by Ralph Schindler
New AgileZen component Support for the full AgileZen API Developed for use with our planning board Work was provided by Enrico Zimuel
PHP 5.4 Support A number of issues when running ZF2 under PHP 5.4 were identified and corrected.

I am happy the team managed to finished the view layer, the database support and the config :-D.

Translate to de es fr it pt ja

Howto - lambda, anonymous functions (or closures) and aspect oriented programming

What a day, while trying to concentrate on task "digging in into Zend Framework 2" (and this task isn't that easy when manufacturers are setting up a drywall near your desk), i found some exiting pages about "anonymous / lambda functions" and "aspect oriented programming".

Lambda, anonymous function or so called closures are functions that are created "on the fly" are available since php 5.3. Since the upcomming zend framework 2 is using them as often as he can, you have to deal with them - so why not take some minutes and learn about them? Nice to have, have a howto about them. But i found an even better "how to" on the web. This how to is written by Fabien Potencier and after reading and trying you are feeling much more comfortable by using them.

Last but not least, when i try to understand the event mechanism in the framework, there was the name "Aspect Oriented Programming". Also for this, another webpage can help you to understand what it is all about, try this blog entry.

Translate to de es fr it pt ja