 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Aura.Web Aura's Page Controller for MVC
by Chris Cornutt June 05, 2013 @ 09:58:42
On PHPMaster.com today Hari K T has spotlighted one of the components from the Aura framework, the Aura.Web component.
MVC is an acronym that means Model-View-Controller. In this tutorial I would like to introduce you to Aura.Web, the controller component of the Aura Library. Here I'll show you how to use it to build your own controller, and also how to use a response transfer object to issue HTTP response headers, and integrate a templating engine like Mustache for rendering views.
He starts off with an overview of how the component is architected and how it is used to create controllers and what dependencies it needs injected. He talks about some of the objects and the methods they provide and includes some sample code for a basic "Index" controller. He shows how to integrate the Mustache templating engine for output and how to work directly with HTTP responses.
voice your opinion now!
auraweb aura framework page controller mvc tutorial introduction
Community News: ZendCon Europe - November 18th-20th (Paris, France)
by Chris Cornutt June 04, 2013 @ 11:18:50
Zend has officially announced that they will be presenting a "sister" conference to the one they already hold each year in California, this time in Europe - ZendCon Europe.
ZendCon PHP 2013 will be the place where European PHP professionals gather this fall. [...] Attend Europe's largest conference focusing on Enterprise PHP solutions, Frameworks, PHP Training and all things PHP. Meet the legends who created PHP and are partly responsible for what the WWW looks like today. Whether you wish to find a job, take PHP training, find a services company to help you, or just meet the greatest developer ecosystem ever -You are in the right place!
The event will be held in Paris, France on November 18th through the 20th at the Marriott Rive Gauche. Following the same pattern as the US version of the conference, the first day will be tutorials with regular sessions the following days. It's still pretty early on so there's no details about the Call for Papers or anything yet, but you can sign up for more information on the current conference site.
voice your opinion now!
zendcon europe zceu13 conference zend paris france november
Rob Allen: Injecting configuration into a ZF2 controller
by Chris Cornutt April 30, 2013 @ 09:11:16
Rob Allen has a a new post to his site today showing you how to inject configuration information into a Zend Framework 2 controller via an interface and some initializer settings in the module setup.
One thing you may find yourself needing to do is access configuration information in a controller or service class. The easiest way to do this is to use the ServiceManger's initialiser feature. This allows you to write one piece of injection code that can be applied to multiple objects. It's easier to show this in action!
He includes a sample configuration file (with a setting for "setting_1") and the interface you implement to structure the load request. He then shows how to hook this into the controller and the code needed for the module "getControllerConfig" (or "getServiceConfig" for use with services) to load in the file and set it to the correct object.
voice your opinion now!
inject configuration controller zendframework2 tutorial file
NetTuts.com: Testing Laravel Controllers
by Chris Cornutt April 24, 2013 @ 09:24:06
NetTuts.com has posted a new article for the Laravel users out there - a tutorial showing how to test Laravel controllers via PHPUnit tests.
Testing controllers isn't the easiest thing in the world. Well, let me rephrase that: testing them is a cinch; what's difficult, at least at first, is determining what to test. Should a controller test verify text on the page? Should it touch the database? Should it ensure that variables exist in the view? If this is your first hay-ride, these things can be confusing! Let me help.
They break up the testing process into three main chunks - isolation of the tests (mocking where need be), calling the controller method and running the checks (assertions) to be sure the result is valid. They start with a basic controller test that runs a GET request on the "posts" method. They also mention the assertion helper methods included with Laravel controller testing, things like "assertRedirectedTo" and "assertSessionHas". The article then gets into moreo practical examples showing a TDD approach to testing some simple controller calls, mocking data connections, handling redirects and repositories.
voice your opinion now!
laravel controller testing tutorial helper
Reddit.com: Dependency injection in ZF2 and Symfony 2 are service locators
by Chris Cornutt April 16, 2013 @ 12:40:07
On Reddit's PHP section there's a discussion happening about dependency injection versus service locators in two popular PHP frameworks - Zend Framework 2 and Symfony 2 (and how they're not really DI at all).
Both ZF2 and Symfony 2 offer the same behavior: if I'm in a controller, and I want to use a service, I have to get it from the container with $this->get('my_service').
As such, the controller is not using DI, this is the service locator pattern. Controllers become more difficult to tests because of that, and they depend on the container now. I wonder why both frameworks didn't go further: why not treat controllers like services and use dependency injection on them. In other words: if a controller needs a service "A", then it should get it in the constructor, or through setter/property injection.
The comments talk some about the "controller from the DI container" idea, some other ways around the problem and some clarification as to what the frameworks are actually doing related to the container injection.
voice your opinion now!
dependency injection service locator controller framework zendframework2 symfony2
NetTuts.com: Taming Slim 2.0
by Chris Cornutt April 02, 2013 @ 09:17:11
On NetTuts.com today there's a new tutorial posted about "taming" Slim 2.0, the latest version of the popular PHP microframework. They look at application structure and share some tips to using this update.
Slim is a lightweight framework that packs a lot of punch for its tiny footprint. It has an incredible routing system, and offers a solid base to work from without getting in your way. Let me show you! But that's not to say that Slim doesn't has some issues; it's one-file setup becomes cluttered as your application grows. In this article, we'll review how to structure a Slim application to not only sustain, but improve its functionality and keep things neat and systematic.
He starts with an example of "vanilla Slim" and looks some at what's happening behind the scenes in the routing engine. They then give you a step by step installation and usage guide including updating the router to use class files. An example controller is included as well as some basic error handling using a Twig template for use across the application.
voice your opinion now!
slim microframework tutorial introduction class controller router error handling
PHPMaster.com: The MVC Pattern and PHP, Part 2
by Chris Cornutt March 12, 2013 @ 11:19:03
PHPMaster.com has posted the second part of their MVC series, introducing you to the Model/View/Controller design pattern. If you want to catch up, part one is here.
Welcome to part 2 of this two-part series discussing MVC and PHP, where we'll discuss some of the considerations one must make when using an MVC architecture. If you've come straight to this article without reading part 1 first, I encourage you to head back and have careful read as this one will assume that you've read and understand everything it discussed.
He talks about some of the things more involved in making a MVC framework including routing and URL formats and working with templates. Sample code is included for the route handling, model/controller relationship and view classes for the templates.
voice your opinion now!
mvc designpattern introduction tutorial model view controller routing view
|
Community Events
Don't see your event here? Let us know!
|