ZfDayIt 2014 - There is a module for everything
-
Upload
gianluca-arbezzano -
Category
Technology
-
view
104 -
download
0
description
Transcript of ZfDayIt 2014 - There is a module for everything
![Page 1: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/1.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Gianluca Arbezzano@GianArb
https://github.com/GianArb
![Page 2: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/2.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
There is a module for everything!
![Page 3: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/3.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
How?!
![Page 4: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/4.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
![Page 5: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/5.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Packaging ANDCode Reuse
![Page 6: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/6.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
PSR are your best friends!
PHP-CS-Fixerhttp://cs.sensiolabs.org/
PSR standards are the pillarsof interoperability
![Page 7: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/7.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Where/is/my/dir?
Follow the framework tree
![Page 8: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/8.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Configuration is necessary..• Do not overdo• Don’t be lazy• Choose pertinent index names• User namespace
• Set default values
![Page 9: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/9.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
There are different configuration layers
module.config.phpglobal.phplocal.php….
Use /config/autoload directory for manageoptions override!
![Page 10: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/10.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Good Implementation!
ZendDeveloperTools\Modulepublic function onBootstrap(EventInterface $event) {
…… if (!$options->isEnabled()) { return; } …... $em->attachAggregate($sm->get('ZendDeveloperTools\ProfilerListener')); if ($options->isToolbarEnabled()) { $sem->attach('profiler', $sm->get('ZendDeveloperTools\ToolbarListener'), null); ……. }
![Page 11: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/11.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
How to register a module inside your application
return array( 'modules' => array( ’Application', ’MyModule’,
….. ), 'module_listener_options' => array( 'config_glob_paths' => array( 'config/autoload/{,*.}{global,local}.php', ), 'module_paths' => array( './module', './vendor', ), ),);
![Page 12: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/12.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Think abaut an overridable
configuration
![Page 13: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/13.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
ConfigApplication'controllers' => array( 'invokables' => array( 'Application\Controller\Index' => 'Application\Controller\IndexController', ),),
MyModule'controllers' => array( 'invokables' => array( 'Application\Controller\Index' => ’MyModule\Controller\IndexController', ),),
![Page 14: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/14.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Override viewsApplicationConfig:'view_manager' => array( 'template_path_stack' => array( __DIR__ . '/../view', ),),
Directorty Structure:view/ index/ index/ index.phtml
MyModuleConfig:'view_manager' => array( 'template_path_stack' => array( __DIR__ . '/../view', ),),
Directory Structure:view/ index/ index/ index.phtml
![Page 15: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/15.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Console Usageclass Module {
public function getConsoleUsage(AdapterInterface $console) {
return array( array('test [--params=]', 'Description of test command’),array('run ', 'Start anction')
); }
}
![Page 16: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/16.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Console entry point
Examplehttps://github.com/doctrine/DoctrineModule/tree/master/bin
Composer:
{…,“bin”: [
bin/console-file],…
}
![Page 17: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/17.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Service locator!
ServiceFactory VS ClosureClosure isn’t serializable
Module.php is more readable
Closures limit the ability to cache the cofiguration
![Page 18: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/18.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Register Event to increase flexibility!
![Page 19: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/19.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Aggregate & composition
![Page 20: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/20.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Composer or Not Composer
Both!
![Page 21: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/21.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Zend Framework is modular!{
“name”: “my-module/use-only-feed-component”,“description”:”Automatic feed reader”,“licence” : “MIT”,…..,“require”:[
“zend-framework/zend-framework” : “2.2.*”],
}
https://github.com/robertboloc/zf2-components-list-generator
"require": { "php": ">=5.3.3", "zendframework/zend-feed": "self.version”},
![Page 22: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/22.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Open Source.. Why?
![Page 23: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/23.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Portfolio
![Page 24: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/24.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
More implementations
= More BUG FIXS
andMore features
![Page 25: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/25.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Implement your module into Zend Skeleton Application
![Page 26: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/26.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
![Page 27: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/27.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
#IRC
#zftalk
#zftalk.modules
![Page 28: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/28.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Test PhpUnit
![Page 29: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/29.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Write Issues! help your future contributors
![Page 30: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/30.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Git: handle with care!
![Page 31: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/31.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
README.md
![Page 32: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/32.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
PhpDoc** * This is a summary. * * This is a description */
![Page 33: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/33.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Documentation
![Page 34: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/34.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Some good modules
![Page 35: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/35.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Some good modules
![Page 36: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/36.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Some good modules
![Page 37: ZfDayIt 2014 - There is a module for everything](https://reader036.fdocuments.net/reader036/viewer/2022062617/54c955e84a7959dd078b4590/html5/thumbnails/37.jpg)
Gianluca Arbezzano - @GianArb – https://github.com/GianArb
Modules Repository