Upgrade to Pro — share decks privately, control downloads, hide ads and more …

construct - Push start PHP package development

construct - Push start PHP package development

Introduction to construct (https://git.io/construct), presented at the PHP User Group Metropolregion Rhein-Neckar.

Raphael Stolt

April 14, 2016
Tweet

More Decks by Raphael Stolt

Other Decks in Programming

Transcript

  1. WHO'S THAT GUY? SOFTWARE DEVELOPER WITH A PHP FOCUS SEITENBAU

    GMBH LOCATED AT LAKE CONSTANCE STREET ART GEEK CIDER 'ER raphaelstolt on    
  2. DISCLAIMER Recommended reading for that matter is the Principles of

    Package Design  by Matthias Noback.  https://leanpub.com/principles-of-package-design
  3. ROADMAP WHAT GOES INTO A PACKAGE? HOW PACKAGE DEVELOPMENT CAN

    BE/IS PUSH STARTED W/O CONSTRUCT? GUIDED  THROUGH CONSTRUCT
  4. WHAT GOES INTO A PACKAGE? Documentation for package users, potential

    contributors, and a possibly existing community Visible strife for quality Helpers for package owners, maintainers, and potential contributors Obviously the actual source code A small  print for released --distributions
  5. HOW TO EVALUATE A PACKAGE? Compare it against the checklist

    curated by Jonathan Reinink  http://phppackagechecklist.com
  6. PACKAGE DEVELOPMENT W/O CONSTRUCT Copy & paste from a mentor-package™

    Utilise skeletons via a dedicated Git repository or Composer Custom template approach via build tools like Phing or the like
  7. OHAI CONSTRUCT PHP project/micro-package generator  https://git.io/construct Initiated and maintained

    by Jonathan Torres Started to get involved via  and seeing a need
  8. SIGNS READ CORRECTLY Statistics show the continuing growth of new

    packages  https://packagist.org/statistics
  9. PACKAGE DEVELOPMENT W/ CONSTRUCT Recommended global installation Ensure that ~/.composer/vendor/bin

    is on your $PATH to have the construct command at your finger tips. $ c o m p o s e r g l o b a l r e q u i r e j o n a t h a n t o r r e s / c o n s t r u c t
  10. PACKAGE DEVELOPMENT W/ CONSTRUCT Available construct generate command options All

    options are also settable in a construct generate:interactive mode. $ c o n s t r u c t g e n e r a t e - - h e l p U s a g e : g e n e r a t e [ o p t i o n s ] [ - - ] < n a m e > A r g u m e n t s : n a m e T h e v e n d o r / p r o j e c t n a m e O p t i o n s : - t , - - t e s t [ = T E S T ] T e s t i n g f r a m e w o r k ( o n e o f : p h p u n i t , b e h a t , p h p s p e c , c o d e c e p t i o n ) [ d e f a u l t - - t e s t - f r a m e w o r k [ = T E S T - F R A M E W O R K ] T e s t i n g f r a m e w o r k ( o n e o f : p h p u n i t , b e h a t , p h p s p e c , c o d e c e p t i o n ) [ d e f a u l t - l , - - l i c e n s e [ = L I C E N S E ] L i c e n s e ( o n e o f : M I T , A p a c h e - 2 . 0 , G P L - 2 . 0 , G P L - 3 . 0 ) [ d e f a u l t : " M I T " - s , - - n a m e s p a c e [ = N A M E S P A C E ] N a m e s p a c e f o r p r o j e c t [ d e f a u l t : " V e n d o r \ P r o j e c t " ] - g , - - g i t I n i t i a l i z e a n e m p t y G i t r e p o - p , - - p h p c s G e n e r a t e a P H P C o d i n g S t a n d a r d s F i x e r c o n f i g u r a t i o n - k , - - k e y w o r d s [ = K E Y W O R D S ] C o m m a s e p a r a t e d l i s t o f C o m p o s e r k e y w o r d s - - v a g r a n t G e n e r a t e a V a g r a n t f i l e - e , - - e d i t o r - c o n f i g G e n e r a t e a n E d i t o r C o n f i g c o n f i g u r a t i o n - - p h p [ = P H P ] P r o j e c t m i n i m u n r e q u i r e d p h p v e r s i o n ( o n e o f : 5 . 4 , 5 . 5 , 5 . 6 , 7 . 0 - - e n v G e n e r a t e . e n v e n v i r o n m e n t f i l e s - - l g t m G e n e r a t e L G T M c o n f i g u r a t i o n f i l e s - - g i t h u b - t e m p l a t e s G e n e r a t e G i t H u b t e m p l a t e s - - c o d e - o f - c o n d u c t G e n e r a t e C o d e o f C o n d u c t f i l e
  11. PACKAGE DEVELOPMENT W/ CONSTRUCT Generate an all inclusive package $

    c o n s t r u c t g e n e r a t e r s / s k e l e t o n - - p h p = 5 . 6 - - t a g s = f o o , b a r - - g i t \ - - p h p c s - - c o d e - o f - c o n d u c t - - l g t m - - g i t h u b - t e m p l a t e s - - v a g r a n t - - e n v \ - - e d i t o r - c o n f i g s k e l e t o n g i t : m a s t e r ❯ t r e e - a L 2 - I ' . g i t | v e n d o r ' . ├ ─ ─ . e d i t o r c o n f i g ├ ─ ─ . e n v ├ ─ ─ . e n v . e x a m p l e ├ ─ ─ . g i t a t t r i b u t e s ├ ─ ─ . g i t h u b │ ├ ─ ─ C O N T R I B U T I N G . m d │ ├ ─ ─ I S S U E _ T E M P L A T E . m d │ └ ─ ─ P U L L _ R E Q U E S T _ T E M P L A T E . m d ├ ─ ─ . g i t i g n o r e ├ ─ ─ . l g t m ├ ─ ─ . p h p _ c s ├ ─ ─ . t r a v i s . y m l ├ ─ ─ C H A N G E L O G . m d ├ ─ ─ C O N D U C T . m d ├ ─ ─ L I C E N S E . m d ├ ─ ─ M A I N T A I N E R S
  12. PACKAGE DEVELOPMENT W/ CONSTRUCT Utilise Composer scripts commands  https://getcomposer.org/doc/articles/scripts.md

    composer.json s k e l e t o n g i t : m a s t e r ❯ c o m p o s e r r u n - s c r i p t - - l i s t s c r i p t s : t e s t c s - f i x . . . " s c r i p t s " : { " t e s t " : " p h p u n i t " , " c s - f i x " : " p h p - c s - f i x e r f i x . - v v | | t r u e " } . . .
  13. PACKAGE DEVELOPMENT W/ CONSTRUCT Developers are enabled to jump right

    into development mode Though we probably should start them with a failing test. s k e l e t o n g i t : m a s t e r ❯ c o m p o s e r t e s t > p h p u n i t P H P U n i t 4 . 8 . 2 4 b y S e b a s t i a n B e r g m a n n a n d c o n t r i b u t o r s . . T i m e : 6 2 m s , M e m o r y : 4 . 0 0 M b O K ( 1 t e s t , 1 a s s e r t i o n )
  14. PACKAGE DEVELOPMENT W/ CONSTRUCT Preconfigured Travis CI .travis.yml l a

    n g u a g e : p h p p h p : - h h v m - n i g h t l y - 5 . 6 - 7 . 0 b e f o r e _ s c r i p t : - t r a v i s _ r e t r y c o m p o s e r s e l f - u p d a t e - t r a v i s _ r e t r y c o m p o s e r i n s t a l l - - n o - i n t e r a c t i o n s c r i p t : - c o m p o s e r t e s t
  15. THINGS (YET) LEFT TO THE DEVELOPER Implement something scratching an

    itch in the PHP ecosystem Put the package repository on  Connect the package repository with the Travis CI and Packagist service hooks Tag and push an initial release
  16. THINGS TO COME IN VERSION 2.0 Ability to load recurring

    option settings from a YAML based configuration file .construct n a m e s p a c e : V e n d o r \ P r o j e c t t e s t - f r a m e w o r k : p h p s p e c l i c e n s e : M I T p h p : 5 . 6 c o n s t r u c t - w i t h : - g i t - p h p c s - v a g r a n t - e d i t o r - c o n f i g - e n v - l g t m - g i t h u b - t e m p l a t e s - c o d e - o f - c o n d u c t
  17. POSSIBLE FEATURE ADDITONS Analyser for running packages against the PHP

    package checklist  http://phppackagechecklist.com
  18.  THANKS Feel free to ask questions or point out

    possible missing features and additions. Please provide some  on joind.in.  https://joind.in/talk/bd542
  19. IMAGE CREDITS Lego - https://www.flickr.com/photos/michellecarl/5716249158 Streetart - https://www.flickr.com/photos/thomaseuler/2853947596/ Roadmap -

    https://www.flickr.com/photos/cmuffins/5101164988 Architecture - https://www.flickr.com/photos/92603560@N04/9549617370/ Library - https://www.flickr.com/photos/flyingblogspot/15361704293 Package content - https://www.flickr.com/photos/orangegreenblue/9186143130/ Measurement - https://www.flickr.com/photos/enerva/14296912543/ Skeleton - https://www.flickr.com/photos/126451798@N05/15953311762/ Ohai - https://www.flickr.com/photos/policastro/4525650045/ Trend - https://www.flickr.com/photos/evassvammel/6565365035/ Installation - https://www.flickr.com/photos/fun3/1428109309/ Console - https://www.flickr.com/photos/43098473@N08/6455193929/ Wheels - https://www.flickr.com/photos/mogrith/5570204662/ Niche - https://www.flickr.com/photos/hawksanddoves/5456584163/ Traffic light - https://www.flickr.com/photos/flrnt/457917184/ Craftsmanship - https://www.flickr.com/photos/toadmahone/3708991854/ Future - https://www.flickr.com/photos/37996583811@N01/6449262007 Outro - https://www.flickr.com/photos/41282415@N06/6347708205/