SlideShare a Scribd company logo
1 of 36
Download to read offline
Writing Services with
         ZF2
Mike Willbanks | Barnes & Noble
Housekeeping…

    •  Talk
      Slides will be posted after the talk.

    •  Me
      Sr. Web Architect Manager at NOOK Developer

      Open Source Contributor

      Where you can find me:
        •  Twitter: mwillbanks          G+: Mike Willbanks
        •  IRC (freenode): mwillbanks   Blog: http://blog.digitalstruct.com
        •  GitHub: https://github.com/mwillbanks




2
Agenda

    •  Background
    •  ZF2 Services
    •  Writing a Service
    •  Implementing your Service




3
Background…
A Definition
    ZF 1 contained Zend_Service_* components



5
Zend_Service_*
    Components were included in the core
    distribution


6
Zend_Service_*
    Make it easy for people to have it available…



7
1.11.13 Release
    Caused several issues



8
Started Getting Messy…




9
Services in ZF2
Changing for the Better

     • RFC March 2012 “RFC Service Components”
        http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+Service
        +Components
     • Removal of ZF2 ZendService namespace into a separate
       namespace and repository.




11
Goals of ZF2 Services

     • Ability to version separately from core framework
     • Easier to leverage outside of a ZF context
     • Encourage service providers to further contribute




12
Services for Contribution (Official Services)

     • Independently versioned
     • Dependencies on framework versions (2.*, 2.0.*, 2.0.1)
     • Maintain dependencies by specific packages
     • Must follow ZF coding standards
     • Must be unique
        A service that does the same thing should not already exist!




13
Service Component Lifecycle



                             Discuss on         IRC Vote
      Build Component    Contributor Mailing    (Meeting
                                List            Agenda)




        CR Team Review       Fork Repo         Publish!




14
Service Maintenance

     • Must be maintained for the duration of major versions
        Exceptions must be noted in the ChangeLog

        Component should only state dependency on minor versions

     • Maintainers must attempt at all times to keep compatibility
       with the latest version
        If unable to maintain, actively recruit, if still unable ZF or CR team
        will make a recommendation on the component.




15
How are we doing so far?




16
Writing a Service
By example of ZendServiceTwitter
General Information

     • Services are really just like framework libraries
        However, the namespace implies 3rd party integrations.

        They are also organized like the framework.

     • Services should be reusable for other developers
        Write it out based on the API and not just what you need.

     • Create reasonable dependencies
        ZendHttp and ZendStdlib being most common.




18
Why Not Modules?

     • Modules are more specifically for ZF
     • Components are reusable libraries for any code base.
     • Base Rule
        If it involves the MVC; it should more than likely be a module.




19
Starting Off..

     • Build out the file structure:
        library/ZendService/Twitter

        tests/ZendService/Twitter

     • Add LICENSE, README, .travis.yml, .gitignore
        Just copy these over from another project

        Update the readme for the project




20
Create Your Composer File




21
Dependencies




22
Unit Testing

     • Because we all do TDD right?
        From a module; copy over the _autoload.php, Bootstrap.php,
        phpunit.xml.dist, TestConfiguration.php.dist,
        TestConfiguration.php.travis
     • You will need to customize
        phpunit.xml.dist – Change out the unit test name.

        TestConfiguration.php.dist – Configure your constants and
        configuration.




23
Unit Testing

     • Tests should contain proper namespacing
        ZendServiceTestTwitter
         • Right now the Twitter component just uses ZendTestTwitter J

     • Files you need should be located in an _files directory
       inside the test area of your component
        tests/ZendService/Twitter/_files

     • Write unit tests like normal!




24
Library Code!

     • The guts of the library is what most of us are familiar with
     • Write your library inside of your compliant directory
        library/ZendService/Twitter

     • Your first file should very well likely be that of the service
       name
        library/ZendService/Twitter/Twitter.php

     • Ensure proper namespacing
        ZendServiceTwitter




25
Coding Standards

     • Remember to make use of the coding standards!
        Docblocks
         • @category    Zend
         • @package      Zend_Service
         • @subpackage Twitter
        Import the proper packages from their respective namespaces
         • No one likes to write out the full namespace time and time again…
        Read the coding standards doc:
         • http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards
         • Mainly; PSR-0, PSR-1, PSR-2 (there are likely slight differences)



26
Documentation

     • The most dreaded part of the job…
     • All of the documentation is in the “zf2-documentation”
       project under the “zendframework” github organization.
        This will likely change for services in the future.



     • Fork the project
     • Create a feature branch: feature/twitter
     • Write your documentation
     • Submit a PR


27
Documenting

     • Documentation is built out of reStructuredText
        Yes, Docbook has gone away; so fear not!

     • Language Files
        Always start with English first aka “en” as it is the default in the
        event a translation is missing.
     • Modify docs/language/en/index.rst to add in your new
       service
        Follow the convention; for a service you will use
        zendservice.twitter.intro.rst
     • Create your file
        docs/language/en/modules/zendservice.twitter.intro.rst or the
        like
28
Seeing your Documentation

     • Install the proper tools
        apt-get install python-setuptools python-pygments

        easy_install -U Sphinx

     • Enter the docs/ directory
     • Run: make html


     • Your documentation will now be in:
        docs/_build/html

        Review for errors before sending the PR



29
Integrating your Service
We will leverage the Skeleton Application

     • Add the module to the composer configuration
     • Add in potential configuration
     • Setup the service manager
     • Fetch it inside of a controller




31
Composerize




      php composer.php install
32
Potential Configuration




33
Setup the Service Manager




34
Controller Integration




35
Questions?

     •  These slides will be posted to SlideShare & SpeakerDeck.
        SpeakerDeck: http://speakerdeck.com/u/mwillbanks

        Slideshare: http://www.slideshare.net/mwillbanks

        Twitter: mwillbanks

        G+: Mike Willbanks

        IRC (freenode): mwillbanks

        Blog: http://blog.digitalstruct.com

        GitHub: https://github.com/mwillbanks




36

More Related Content

What's hot

Choosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdChoosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdJosh Padnick
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to MavenEric Wyles
 
Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Summer Lu
 
Jenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with JenkinsJenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with JenkinsAll Things Open
 
FAST for SharePoint Deep Dive
FAST for SharePoint Deep DiveFAST for SharePoint Deep Dive
FAST for SharePoint Deep Diveneil_richards
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Mihail Stoynov
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...Jesse Gallagher
 
Embrace Maven
Embrace MavenEmbrace Maven
Embrace MavenGuy Marom
 
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-CodeSD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-CodeBrian Dawson
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesJesse Gallagher
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experienceAlex Tumanoff
 
Migrating to Git: Rethinking the Commit
Migrating to Git:  Rethinking the CommitMigrating to Git:  Rethinking the Commit
Migrating to Git: Rethinking the CommitKim Moir
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSam Brannen
 
Peering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityPeering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityVMware Tanzu
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Clark Everetts
 
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 PipelineDelivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 PipelineSlawa Giterman
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
 

What's hot (19)

Choosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in ProdChoosing the Right Framework for Running Docker Containers in Prod
Choosing the Right Framework for Running Docker Containers in Prod
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
Jenkins
JenkinsJenkins
Jenkins
 
Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)Workshop Framework(J2EE/OSGi/RCP)
Workshop Framework(J2EE/OSGi/RCP)
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Jenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with JenkinsJenkins 101: Continuos Integration with Jenkins
Jenkins 101: Continuos Integration with Jenkins
 
FAST for SharePoint Deep Dive
FAST for SharePoint Deep DiveFAST for SharePoint Deep Dive
FAST for SharePoint Deep Dive
 
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
Modules in Java? Finally! (OpenJDK 9 Jigsaw, JSR376)
 
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
 
Embrace Maven
Embrace MavenEmbrace Maven
Embrace Maven
 
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-CodeSD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
SD DevOps Meet-up - Jenkins 2.0 and Pipeline-as-Code
 
CollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPagesCollabSphere 2018 - Java in Domino After XPages
CollabSphere 2018 - Java in Domino After XPages
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
Migrating to Git: Rethinking the Commit
Migrating to Git:  Rethinking the CommitMigrating to Git:  Rethinking the Commit
Migrating to Git: Rethinking the Commit
 
Spring Framework 3.2 - What's New
Spring Framework 3.2 - What's NewSpring Framework 3.2 - What's New
Spring Framework 3.2 - What's New
 
Peering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for ObservabilityPeering Inside the Black Box: A Case for Observability
Peering Inside the Black Box: A Case for Observability
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017
 
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 PipelineDelivery Pipeline as Code: using Jenkins 2.0 Pipeline
Delivery Pipeline as Code: using Jenkins 2.0 Pipeline
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 

Viewers also liked

Implementing security routines with zf2
Implementing security routines with zf2Implementing security routines with zf2
Implementing security routines with zf2Er Galvão Abbott
 
Ido Green - YQL demo
Ido Green - YQL demoIdo Green - YQL demo
Ido Green - YQL demoIdo Green
 
What do you do when facing unfamiliar challenge?
What do you do when facing unfamiliar challenge?What do you do when facing unfamiliar challenge?
What do you do when facing unfamiliar challenge?Clint Walters
 
Axiologix Company Presentation Jan 2011
Axiologix Company Presentation Jan 2011Axiologix Company Presentation Jan 2011
Axiologix Company Presentation Jan 2011InboundMarketingPR.com
 
Kenzy klauser vet speech and preso
Kenzy klauser vet speech and presoKenzy klauser vet speech and preso
Kenzy klauser vet speech and presoDavid R. Klauser
 
Draft presentazione innova_day
Draft presentazione innova_dayDraft presentazione innova_day
Draft presentazione innova_dayFrancesco Baruffi
 
Success Magazine
Success MagazineSuccess Magazine
Success Magazinepayitearly
 
Marriott Miami Airport Campus Updated
Marriott Miami Airport Campus UpdatedMarriott Miami Airport Campus Updated
Marriott Miami Airport Campus Updateddlopez9
 
Power Point Polmoni
Power Point PolmoniPower Point Polmoni
Power Point Polmonimapaa
 
Presentation1 Intro To Computers Week 7
Presentation1 Intro To Computers Week 7Presentation1 Intro To Computers Week 7
Presentation1 Intro To Computers Week 7Ashley Bohannon
 
Portfolio of Mariya Pantyukhina
Portfolio of Mariya PantyukhinaPortfolio of Mariya Pantyukhina
Portfolio of Mariya PantyukhinaMariya Pantyukhina
 
Is it Hard Money or Hard to Get Money?
Is it Hard Money or Hard to Get Money? Is it Hard Money or Hard to Get Money?
Is it Hard Money or Hard to Get Money? Joseph Andahazy
 
Practical Econ, U1, Packet 1
Practical Econ, U1, Packet 1Practical Econ, U1, Packet 1
Practical Econ, U1, Packet 1NHSDAnderson
 
Ruby In Enterprise Development
Ruby In Enterprise DevelopmentRuby In Enterprise Development
Ruby In Enterprise DevelopmentRobbin Fan
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel DevelopmentMohammed Farrag
 

Viewers also liked (20)

Implementing security routines with zf2
Implementing security routines with zf2Implementing security routines with zf2
Implementing security routines with zf2
 
Gerência do Tempo
Gerência do TempoGerência do Tempo
Gerência do Tempo
 
Ido Green - YQL demo
Ido Green - YQL demoIdo Green - YQL demo
Ido Green - YQL demo
 
What do you do when facing unfamiliar challenge?
What do you do when facing unfamiliar challenge?What do you do when facing unfamiliar challenge?
What do you do when facing unfamiliar challenge?
 
Presentation1
Presentation1Presentation1
Presentation1
 
Axiologix Company Presentation Jan 2011
Axiologix Company Presentation Jan 2011Axiologix Company Presentation Jan 2011
Axiologix Company Presentation Jan 2011
 
Kenzy klauser vet speech and preso
Kenzy klauser vet speech and presoKenzy klauser vet speech and preso
Kenzy klauser vet speech and preso
 
Draft presentazione innova_day
Draft presentazione innova_dayDraft presentazione innova_day
Draft presentazione innova_day
 
Book V Getting The Internship You Want: How to write APPIC essays that get ...
Book V  Getting The Internship You Want:  How to write APPIC essays that get ...Book V  Getting The Internship You Want:  How to write APPIC essays that get ...
Book V Getting The Internship You Want: How to write APPIC essays that get ...
 
Success Magazine
Success MagazineSuccess Magazine
Success Magazine
 
Marriott Miami Airport Campus Updated
Marriott Miami Airport Campus UpdatedMarriott Miami Airport Campus Updated
Marriott Miami Airport Campus Updated
 
Power Point Polmoni
Power Point PolmoniPower Point Polmoni
Power Point Polmoni
 
Presentation1 Intro To Computers Week 7
Presentation1 Intro To Computers Week 7Presentation1 Intro To Computers Week 7
Presentation1 Intro To Computers Week 7
 
The Armory
The ArmoryThe Armory
The Armory
 
Portfolio of Mariya Pantyukhina
Portfolio of Mariya PantyukhinaPortfolio of Mariya Pantyukhina
Portfolio of Mariya Pantyukhina
 
Is it Hard Money or Hard to Get Money?
Is it Hard Money or Hard to Get Money? Is it Hard Money or Hard to Get Money?
Is it Hard Money or Hard to Get Money?
 
Practical Econ, U1, Packet 1
Practical Econ, U1, Packet 1Practical Econ, U1, Packet 1
Practical Econ, U1, Packet 1
 
Ruby In Enterprise Development
Ruby In Enterprise DevelopmentRuby In Enterprise Development
Ruby In Enterprise Development
 
Lecture 5 Kernel Development
Lecture 5 Kernel DevelopmentLecture 5 Kernel Development
Lecture 5 Kernel Development
 
Unit3
Unit3Unit3
Unit3
 

Similar to Writing Services with ZF2

Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...Max Romanovsky
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZFRalph Schindler
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZendCon
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworksKirk Madera
 
Source control - what you need to know
Source control - what you need to knowSource control - what you need to know
Source control - what you need to knowdaveymni
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studyGaetano Giunta
 
Porting Projects to .NET 5
Porting Projects to .NET 5Porting Projects to .NET 5
Porting Projects to .NET 5Immo Landwerth
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET Dmytro Mindra
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...E. Camden Fisher
 
Streams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik KnopStreams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik KnopPerforce
 
Git Going w/ Git
Git Going w/ GitGit Going w/ Git
Git Going w/ GitheyMP
 
SOA with Zend Framework
SOA with Zend FrameworkSOA with Zend Framework
SOA with Zend FrameworkMike Willbanks
 
How to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power UserHow to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power UserStrongback Consulting
 
Domain Specific Development using T4
Domain Specific Development using T4Domain Specific Development using T4
Domain Specific Development using T4Joubin Najmaie
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous IntegrationXPDays
 

Similar to Writing Services with ZF2 (20)

Extending Zend_Tool
Extending Zend_ToolExtending Zend_Tool
Extending Zend_Tool
 
Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...Symfony under control. Continuous Integration and Automated Deployments in Sy...
Symfony under control. Continuous Integration and Automated Deployments in Sy...
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZF
 
Zend_Tool: Practical use and Extending
Zend_Tool: Practical use and ExtendingZend_Tool: Practical use and Extending
Zend_Tool: Practical use and Extending
 
They why behind php frameworks
They why behind php frameworksThey why behind php frameworks
They why behind php frameworks
 
Source control - what you need to know
Source control - what you need to knowSource control - what you need to know
Source control - what you need to know
 
Symfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case studySymfony2 for legacy app rejuvenation: the eZ Publish case study
Symfony2 for legacy app rejuvenation: the eZ Publish case study
 
Zend Framwork configurations
Zend Framwork configurationsZend Framwork configurations
Zend Framwork configurations
 
Porting Projects to .NET 5
Porting Projects to .NET 5Porting Projects to .NET 5
Porting Projects to .NET 5
 
Zend Framwork presentation
Zend Framwork presentationZend Framwork presentation
Zend Framwork presentation
 
Zend Code in ZF 2.0
Zend Code in ZF 2.0Zend Code in ZF 2.0
Zend Code in ZF 2.0
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
Streams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik KnopStreams in Parallel Development by Sven Erik Knop
Streams in Parallel Development by Sven Erik Knop
 
Git Going w/ Git
Git Going w/ GitGit Going w/ Git
Git Going w/ Git
 
SOA with Zend Framework
SOA with Zend FrameworkSOA with Zend Framework
SOA with Zend Framework
 
Versioning for Developers
Versioning for DevelopersVersioning for Developers
Versioning for Developers
 
How to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power UserHow to become a Rational Developer for IBM i Power User
How to become a Rational Developer for IBM i Power User
 
Domain Specific Development using T4
Domain Specific Development using T4Domain Specific Development using T4
Domain Specific Development using T4
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 

More from Mike Willbanks

2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queueMike Willbanks
 
Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Mike Willbanks
 
Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012Mike Willbanks
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Mike Willbanks
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Mike Willbanks
 
Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Mike Willbanks
 
Leveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsLeveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsMike Willbanks
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleMike Willbanks
 
Varnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyVarnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyMike Willbanks
 
Zend Framework Push Notifications
Zend Framework Push NotificationsZend Framework Push Notifications
Zend Framework Push NotificationsMike Willbanks
 
Mobile Push Notifications
Mobile Push NotificationsMobile Push Notifications
Mobile Push NotificationsMike Willbanks
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011Mike Willbanks
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKXMike Willbanks
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101Mike Willbanks
 
The Art of Message Queues
The Art of Message QueuesThe Art of Message Queues
The Art of Message QueuesMike Willbanks
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 

More from Mike Willbanks (19)

2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queue
 
Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012Varnish Cache - International PHP Conference Fall 2012
Varnish Cache - International PHP Conference Fall 2012
 
Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012Message Queues : A Primer - International PHP Conference Fall 2012
Message Queues : A Primer - International PHP Conference Fall 2012
 
Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)Push to Me: Mobile Push Notifications (Zend Framework)
Push to Me: Mobile Push Notifications (Zend Framework)
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
 
Varnish Cache
Varnish CacheVarnish Cache
Varnish Cache
 
Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.Varnish, The Good, The Awesome, and the Downright Crazy.
Varnish, The Good, The Awesome, and the Downright Crazy.
 
Leveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push NotificationsLeveraging Zend Framework for Sending Push Notifications
Leveraging Zend Framework for Sending Push Notifications
 
Gearman: A Job Server made for Scale
Gearman: A Job Server made for ScaleGearman: A Job Server made for Scale
Gearman: A Job Server made for Scale
 
Varnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright CrazyVarnish, The Good, The Awesome, and the Downright Crazy
Varnish, The Good, The Awesome, and the Downright Crazy
 
Zend Framework Push Notifications
Zend Framework Push NotificationsZend Framework Push Notifications
Zend Framework Push Notifications
 
Mobile Push Notifications
Mobile Push NotificationsMobile Push Notifications
Mobile Push Notifications
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
Art Of Message Queues
Art Of Message QueuesArt Of Message Queues
Art Of Message Queues
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
The Art of Message Queues
The Art of Message QueuesThe Art of Message Queues
The Art of Message Queues
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
LiquiBase
LiquiBaseLiquiBase
LiquiBase
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Writing Services with ZF2

  • 1. Writing Services with ZF2 Mike Willbanks | Barnes & Noble
  • 2. Housekeeping… •  Talk  Slides will be posted after the talk. •  Me  Sr. Web Architect Manager at NOOK Developer  Open Source Contributor  Where you can find me: •  Twitter: mwillbanks G+: Mike Willbanks •  IRC (freenode): mwillbanks Blog: http://blog.digitalstruct.com •  GitHub: https://github.com/mwillbanks 2
  • 3. Agenda •  Background •  ZF2 Services •  Writing a Service •  Implementing your Service 3
  • 5. A Definition ZF 1 contained Zend_Service_* components 5
  • 6. Zend_Service_* Components were included in the core distribution 6
  • 7. Zend_Service_* Make it easy for people to have it available… 7
  • 8. 1.11.13 Release Caused several issues 8
  • 11. Changing for the Better • RFC March 2012 “RFC Service Components”   http://framework.zend.com/wiki/display/ZFDEV2/RFC+-+Service +Components • Removal of ZF2 ZendService namespace into a separate namespace and repository. 11
  • 12. Goals of ZF2 Services • Ability to version separately from core framework • Easier to leverage outside of a ZF context • Encourage service providers to further contribute 12
  • 13. Services for Contribution (Official Services) • Independently versioned • Dependencies on framework versions (2.*, 2.0.*, 2.0.1) • Maintain dependencies by specific packages • Must follow ZF coding standards • Must be unique   A service that does the same thing should not already exist! 13
  • 14. Service Component Lifecycle Discuss on IRC Vote Build Component Contributor Mailing (Meeting List Agenda) CR Team Review Fork Repo Publish! 14
  • 15. Service Maintenance • Must be maintained for the duration of major versions   Exceptions must be noted in the ChangeLog   Component should only state dependency on minor versions • Maintainers must attempt at all times to keep compatibility with the latest version   If unable to maintain, actively recruit, if still unable ZF or CR team will make a recommendation on the component. 15
  • 16. How are we doing so far? 16
  • 17. Writing a Service By example of ZendServiceTwitter
  • 18. General Information • Services are really just like framework libraries   However, the namespace implies 3rd party integrations.   They are also organized like the framework. • Services should be reusable for other developers   Write it out based on the API and not just what you need. • Create reasonable dependencies   ZendHttp and ZendStdlib being most common. 18
  • 19. Why Not Modules? • Modules are more specifically for ZF • Components are reusable libraries for any code base. • Base Rule   If it involves the MVC; it should more than likely be a module. 19
  • 20. Starting Off.. • Build out the file structure:   library/ZendService/Twitter   tests/ZendService/Twitter • Add LICENSE, README, .travis.yml, .gitignore   Just copy these over from another project   Update the readme for the project 20
  • 23. Unit Testing • Because we all do TDD right?   From a module; copy over the _autoload.php, Bootstrap.php, phpunit.xml.dist, TestConfiguration.php.dist, TestConfiguration.php.travis • You will need to customize   phpunit.xml.dist – Change out the unit test name.   TestConfiguration.php.dist – Configure your constants and configuration. 23
  • 24. Unit Testing • Tests should contain proper namespacing   ZendServiceTestTwitter • Right now the Twitter component just uses ZendTestTwitter J • Files you need should be located in an _files directory inside the test area of your component   tests/ZendService/Twitter/_files • Write unit tests like normal! 24
  • 25. Library Code! • The guts of the library is what most of us are familiar with • Write your library inside of your compliant directory   library/ZendService/Twitter • Your first file should very well likely be that of the service name   library/ZendService/Twitter/Twitter.php • Ensure proper namespacing   ZendServiceTwitter 25
  • 26. Coding Standards • Remember to make use of the coding standards!   Docblocks • @category Zend • @package Zend_Service • @subpackage Twitter   Import the proper packages from their respective namespaces • No one likes to write out the full namespace time and time again…   Read the coding standards doc: • http://framework.zend.com/wiki/display/ZFDEV2/Coding+Standards • Mainly; PSR-0, PSR-1, PSR-2 (there are likely slight differences) 26
  • 27. Documentation • The most dreaded part of the job… • All of the documentation is in the “zf2-documentation” project under the “zendframework” github organization.   This will likely change for services in the future. • Fork the project • Create a feature branch: feature/twitter • Write your documentation • Submit a PR 27
  • 28. Documenting • Documentation is built out of reStructuredText   Yes, Docbook has gone away; so fear not! • Language Files   Always start with English first aka “en” as it is the default in the event a translation is missing. • Modify docs/language/en/index.rst to add in your new service   Follow the convention; for a service you will use zendservice.twitter.intro.rst • Create your file   docs/language/en/modules/zendservice.twitter.intro.rst or the like 28
  • 29. Seeing your Documentation • Install the proper tools   apt-get install python-setuptools python-pygments   easy_install -U Sphinx • Enter the docs/ directory • Run: make html • Your documentation will now be in:   docs/_build/html   Review for errors before sending the PR 29
  • 31. We will leverage the Skeleton Application • Add the module to the composer configuration • Add in potential configuration • Setup the service manager • Fetch it inside of a controller 31
  • 32. Composerize php composer.php install 32
  • 34. Setup the Service Manager 34
  • 36. Questions? •  These slides will be posted to SlideShare & SpeakerDeck.   SpeakerDeck: http://speakerdeck.com/u/mwillbanks   Slideshare: http://www.slideshare.net/mwillbanks   Twitter: mwillbanks   G+: Mike Willbanks   IRC (freenode): mwillbanks   Blog: http://blog.digitalstruct.com   GitHub: https://github.com/mwillbanks 36