PHP UK Conference 2013

La nueva arquitectura de Zend Framework 2 basada en eventos y módulos

Enrico Zimuel  · 

Presentación

Vídeo

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

so welcome to this talk we are going to I'm going to present the new yorka texture of Jim farmer to first of all let me introduce a little bit myself my name is Enrico Zimmer I come from hitting as you can recognize from my brilliant essence I'm a

software engineer since 1996 I work in ads and technologies in the gem framework team I am an international speaker and actually I guess this is the 60 conference that I presence in my life I'm i wrote a couple of books about secure software and web programming

and i'm also the co-founder of the PHP user group of torino torino is the city where I live in the north of Italy and I strongly suggest to visit it because it's a very nice and historical city in Italy okay let's start with the presentation first

of all if you want to have a chance to get one of this green elephant I suggest to come close because at the end of representation there will be some interesting stuff going on so I'm not Superman I'm not able to throw the elephant at the end of the

room so if you want to have a chance please come close okay so what is them framework first of all who is using xem phim were too okay Jim Frey maquon okay hi I suspect so of is a you know an open source framework since 2006 is 100 percents object orientation

programming so it's use PHP 5.3 point three it's completely unit tested and basically we wrote from scratch they the architecture the internals of the framework we visit the new yorka texture using events using services and models and i'm going

to show you in details one of each day's three components we had that also a couple of new classes especially about security so we spend a lot of time trying to give you the best tools to be able to create web application with the security in mind so for

instance we had the cryptographic components so that is a specific class that you can use for instance to store the credit card information of your users only you know sensitive data that you have to manage the password for instance I don't know if you

was yesterday here that was talking about PHP 5.5 that we will have a new password hashing API we already support the big rips algorithm in them framework so so you can use it starting from version PHP 5.3 so you don't have to wait for the PHP 5.5 because

by the way bcrypt is already in PHP is under the crypt function of PHP so the API is not so easy to use so basically we simplify the houses to that API and a new interesting feature about the framer 2 is the support of composure and Pirus so that means you

can that the framework using composer and you even can choose specific class specific sub components in the framework for instance if you don't have to use the entire frame of you just interested in cryptographic in that Zen crypt library you can just

use it specifying in composer so it's very it's very simple the usage and this is the official website for immersion com so basically when we decide to revive from scratch the framework first of all why we revived from scratch because we jump it in

PHP 5.3 so we use it the namespace we use the closure functions and so so that's why Jim framework to is not backward compatible with them from require is a a technical problem so because we jump in them in PHP 5.3 we decide okay we want to provide you

the best architecture best flexibility for them framework so that's why basically we we're arrived from scratch and we apply the solid principle so solid is an acronym for single responsibility open close it liskov substitution interface segregation

and dependency inversion so basically our common design pattern in software engineering very well know in other you know technologies for instance like you know java more object orientation programming but we use it to you know to fall over to create you know

basically a solid architecture and especially about the dependency injection we use a lot dependency injection so the principle of the single responsibility and the open/close it is managed using part of the dependency injection inside the framework so that

means each components of the framework is completely separate so you can use injecting the dependency into the components we don't have anymore artcore dependencies inside the class that's why it's possible to ship each component using for instance

composer why is too easy to get subsets of the framework and use it we use the service locator and I will show you more details in a couple of minutes and we have finally we support the modular architecture so that means you can ship single components and

you can create model so this is another new about enzyme framework to so basically you can create models that are sub part of application and you can ship this model and you can reuse the model that's very important and we use it extensively the interface

inside the framework so this is also another best practice it's easy to you know to integrate the class the components of the framework in your project basically and extend it so this is a diagram that basically show you how the new MVC architecture of

Jim framework to is built so basically we have three main components that are the events the modules and the services so what is our events and evens basically is an action so you can think and events like an action and actually is also a value object in order

to manage the events in them frame were too we use the inner manager that is a component that manage the events inside the workflow of an application and we have a listener that is basically a callback that reacts to onin evens and basically the heav'n

manager is a component that holds a collection of a listener and for one or more events and trigger the events and execute the events so here there is a an example so imagine that you are in a you're writing ads informative application and you want to

create a new listener so basically you have to get there even manager on the first line I don't know if you can read at the end of the room anyway you get the event manager so you get the instance of the even manager and you just attach this events with

the name do as you can see here we are using just for you know for this example a closure so dollar e is the variable that contains the events the object that you are managing basically and you can get the name of the event the target the parameters using

for instance this get name get target and get parameter and we are just printing a couple of information here so in order to attach an event this is the way to do it of course we want to insert the triggering of the events inside the components to imagine

that you have class and you want to trigger the events we have this API this trigger function as you can see here we are always getting the the instance of the event manager and we are just executing triggering the events inside the function that in this case

[ ... ]

Nota: se han omitido las otras 3.423 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.