Your SlideShare is downloading. ×
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
ZfDayIt 2014 - There is a module for everything
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

ZfDayIt 2014 - There is a module for everything

1,206

Published on

There is a module for evenrything, zend framework is a modular framework. How can I write good code? …

There is a module for evenrything, zend framework is a modular framework. How can I write good code?
Packaging and reuse code is an important practice for write good application.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,206
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Gianluca Arbezzano @GianArb https://github.com/GianArb Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 2. There is a module for everything! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 3. How?! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 4. Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 5. Packaging AND Code Reuse Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 6. PSR are your best friends! PSR standards are the pillars of interoperability PHP-CS-Fixer http://cs.sensiolabs.org/ Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 7. Where/is/my/dir? Follow the framework tree Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 8. Configuration is necessary.. • Do not overdo • Don’t be lazy • Choose pertinent index names • User namespace • Set default values Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 9. There are different configuration layers module.config.php global.php local.php …. Use /config/autoload directory for manage options override! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 10. Good Implementation! ZendDeveloperToolsModule public function onBootstrap(EventInterface $event) { …… if (!$options->isEnabled()) { return; } …... $em->attachAggregate($sm->get('ZendDeveloperToolsProfilerListener')); if ($options->isToolbarEnabled()) { $sem->attach('profiler', $sm->get('ZendDeveloperToolsToolbarListener'), null); ……. } Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 11. 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', ), ), ); Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 12. Think abaut an overridable configuration Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 13. Config Application 'controllers' => array( 'invokables' => array( 'ApplicationControllerIndex' => 'ApplicationControllerIndexController', ), ), MyModule 'controllers' => array( 'invokables' => array( 'ApplicationControllerIndex' => ’MyModuleControllerIndexController', ), ), Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 14. Override views Application MyModule Config: Config: 'view_manager' => array( 'template_path_stack' => array( __DIR__ . '/../view', ), ), 'view_manager' => array( 'template_path_stack' => array( __DIR__ . '/../view', ), ), Directorty Structure: Directory Structure: view/ index/ index/ index.phtml view/ index/ index/ index.phtml Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 15. Console Usage class Module { public function getConsoleUsage(AdapterInterface $console) { return array( array('test [--params=]', 'Description of test command’), array('run ', 'Start anction') ); } } Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 16. Console entry point Example https://github.com/doctrine/DoctrineModule/tree/master/bin Composer: { …, “bin”: [ bin/console-file ], … } Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 17. Service locator! ServiceFactory VS Closure Closure isn’t serializable Module.php is more readable Closures limit the ability to cache the cofiguration Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 18. Register Event to increase flexibility! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 19. Aggregate & composition Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 20. Composer or Not Composer Both! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 21. Zend Framework is modular! { “name”: “my-module/use-only-feed-component”, “description”:”Automatic feed reader”, “licence” : “MIT”, ….., “require”:[ “zend-framework/zend-framework” : “2.2.*” ], } "require": { "php": ">=5.3.3", "zendframework/zend-feed": "self.version” }, https://github.com/robertboloc/zf2-components-list-generator Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 22. Open Source.. Why? Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 23. Portfolio Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 24. More implementations = More BUG FIXS and More features Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 25. Implement your module into Zend Skeleton Application Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 26. Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 27. #IRC #zftalk #zftalk.modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 28. Test PhpUnit Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 29. Write Issues! help your future contributors Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 30. Git: handle with care! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 31. README.md Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 32. PhpDoc ** * This is a summary. * * This is a description */ Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 33. Documentation Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 34. Some good modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 35. Some good modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 36. Some good modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
  • 37. Modules Repository Gianluca Arbezzano - @GianArb – https://github.com/GianArb

×