Zend\ServiceManager is usually configured in two places: an array in a config file or a method within your Module class. In either case, you provide a nested array of configuration information. For example, in a config file:
'service_manager' => array(
'invokables' => array(
'session' => 'ZendSessionStorageSessionStorage',
'factories' => array(
'db' => 'ZendDbAdapterAdapterServiceFactory',
Within the service_manager array, there are a set of nested arrays which are generally used to configure how you want a given class to be instantiated. the names of these sub-arrays are hardcoded, so you just need… continue reading.
Sending a multi-part email with Zend\Mail is easy enough, but if you want to send an HTML email with a text alternative, you need to remember to set the content-type in the headers to multipart/alternative. As this is the second time I had to work this out, I'm noting it here for the next time I forget!
use Zend\Mime\Message as MimeMessage;
use Zend\Mime\Part as MimePart;
function sendMail($htmlBody, $textBody, $subject, $from, $to)
$htmlPart = new MimePart($htmlBody);
$htmlPart->type = "text/html";
$textPart = new MimePart($textBody);
$textPart->type = "text/plain";
$body = new MimeMessage();
$message = new MailMessage();
$transport = new Mail\Transport\Sendmail();
PHPNW12 was excellent. I gave a tutorial with Evan Coury and also talk on ZendForm, both of which seemed to be appreciated. I also took some photos! Tutorial day: Paul at the hackathon: Keynote speaker Ade Oshineye: Hacking in the bar: Michelangelo's closing keynote: All in all, it was an excellent conference and I recommend that you read Rafael's write up to get a feel for what it was like.
Jurian Sluiman has posted Using Zend Framework service managers in your application 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. I address the following topics: What are the different service managers? For what reason are different managers used? How does the service locator relate to the service manager?… continue reading.
If you are coming to the ZF2 tutorial at PHPNW12, then you will get the best out of it if you do a little preparation before you arrive. Laptop You should bring a laptop with the following working on it: A web server (preferably Apache) running PHP 5.3.3 or higher A working MySQL server along with an administration tool such as phpMyAdmin A text editor or IDE that you're comfortable coding with Vhost set up… continue reading.
Reese has posted ZF2: Using the ServiceManager as an Inversion of Control Container (Part 1) In Zend Framework 1, it was difficult to follow best practices when it came to writing testable code. Sure, you could make testable models, but once you need those models in a controller, what do you do? Zend Framework 2 makes it much easier. In this post, I'll cover the basics of injecting a model into a controller. He then… continue reading.
If you need different layout scripts to be rendered for different modules in Zend Framework 2, then Evan Coury has made this extremely easy. His new module EdpModuleLayouts is just the ticket! Once installed, you simply have to add a new array to a config file in the config/autoload folder with the following in it:
'module_layouts' => array(
'Application' => 'layout/application',
'ZfcUser' => 'layout/user',
i.e. you provide a list of the module name against the layout script to use. What could be easier?… continue reading.
Matthew Weier O'Phinney has posted to the ZF blog that Zend Framework 2.0.0 STABLE has been released. Welcome to a new generation of Zend Framework! If you've been waiting, now is the time to download the Skeleton Application, and start playing. There's a fairly good ZF2 tutorial within the official documentation too! Also, don't forget that if you're in the UK/Europe, Evan and I are doing a full day of ZF2 training at the PHPNW12… continue reading.
Evan and I are giving a joint Zend Framework 2 tutorial at the PHPNW12 and ZendCon conferences this year and, consequently, we needed a way to create the presentation collaboratively, ideally using a text based system which we could store in git. There are plenty of HTML5/JS based solutions out there and we decided on landslide which is a python based markdown -> HTML presentation system. However, I really didn't like any of the default… continue reading.
Following on from last year, PHPNW 12 has a tutorial day again on 5th October 2012 and Evan Coury and I are presenting a full day tutorial on Zend Framework 2. The Zend Framework 2 tutorial day will be fantastic! This is the information about it: With Zend Framework 2 released, this tutorial will walk you through building a complete ZF2 MVC application from the ground up. Starting with the ZF2 skeleton application, we’ll discuss… continue reading.