• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
ZfDayIt 2014 - There is a module for everything
 

ZfDayIt 2014 - There is a module for everything

on

  • 1,054 views

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.

Statistics

Views

Total Views
1,054
Views on SlideShare
1,009
Embed Views
45

Actions

Likes
0
Downloads
2
Comments
0

3 Embeds 45

http://www.gianarb.it 38
http://lanyrd.com 4
http://www.linkedin.com 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    ZfDayIt 2014 - There is a module for everything ZfDayIt 2014 - There is a module for everything Presentation Transcript

    • Gianluca Arbezzano @GianArb https://github.com/GianArb Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • There is a module for everything! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • How?! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Packaging AND Code Reuse Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • 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
    • Where/is/my/dir? Follow the framework tree 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 Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • 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
    • 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
    • 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
    • Think abaut an overridable configuration Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Config Application 'controllers' => array( 'invokables' => array( 'ApplicationControllerIndex' => 'ApplicationControllerIndexController', ), ), MyModule 'controllers' => array( 'invokables' => array( 'ApplicationControllerIndex' => ’MyModuleControllerIndexController', ), ), Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • 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
    • 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
    • Console entry point Example https://github.com/doctrine/DoctrineModule/tree/master/bin Composer: { …, “bin”: [ bin/console-file ], … } Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • 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
    • Register Event to increase flexibility! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Aggregate & composition Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Composer or Not Composer Both! 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.*” ], } "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
    • Open Source.. Why? Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Portfolio Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • More implementations = More BUG FIXS and More features Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Implement your module into Zend Skeleton Application Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • #IRC #zftalk #zftalk.modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Test PhpUnit Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Write Issues! help your future contributors Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Git: handle with care! Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • README.md Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • PhpDoc ** * This is a summary. * * This is a description */ Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Documentation Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Some good modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Some good modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Some good modules Gianluca Arbezzano - @GianArb – https://github.com/GianArb
    • Modules Repository Gianluca Arbezzano - @GianArb – https://github.com/GianArb