SlideShare a Scribd company logo
1 of 44
Download to read offline
Into the ZF2 Service
Manager
Chris	
  Tankersley	
  
ZendCon	
  2015	
  
ZendCon	
  2015	
   1	
  
Who Am I
•  PHP	
  Programmer	
  for	
  over	
  10	
  years	
  
•  Been	
  using	
  ZF	
  since	
  ~0.5	
  
•  Daily	
  ZF2	
  user	
  
•  hBps://github.com/dragonmantank	
  
ZendCon	
  2015	
   2	
  
A running joke…
•  “Symfony2	
  is	
  a	
  PHP	
  script	
  that	
  turns	
  YAML	
  into	
  applicaNons”	
  
•  “Yeah,	
  but	
  Zend	
  Framework	
  2	
  is	
  a	
  PHP	
  script	
  that	
  turns	
  arrays	
  into	
  
applicaNons”	
  
ZendCon	
  2015	
   3	
  
ZendCon	
  2015	
   4	
  
It kind of is…
ZendCon	
  2015	
   5	
  
return	
  [	
  
	
  	
  	
  	
  'service_manager'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  'initializers'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'JobServiceJobServiceAwareInitializer'	
  
	
  	
  	
  	
  	
  	
  	
  	
  ],	
  
	
  	
  	
  	
  	
  	
  	
  	
  'invokables'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'JobProcessorListener'	
  =>	
  'JobProcessorProcessorListener',	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'JobServiceAccountListener'	
  =>	
  'JobServiceJobServiceListener’	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  ],	
  
	
  	
  	
  	
  	
  	
  	
  	
  'factories'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'JobService'	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  =>	
  'JobServiceJobServiceFactory',	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'JobProcessor'	
  	
  	
  	
  	
  	
  	
  	
  	
  =>	
  'JobProcessorProcessorFactory',	
  
	
  	
  	
  	
  	
  	
  	
  	
  ]	
  
	
  	
  	
  	
  ]	
  
]	
  
Theater Magic
•  When	
  something	
  awesome	
  happens,	
  but	
  it’s	
  really	
  something	
  
mundane	
  controlling	
  it	
  in	
  the	
  background	
  
•  When	
  it	
  looks	
  good	
  from	
  25’	
  
ZendCon	
  2015	
   6	
  
The Service Manager
ZendCon	
  2015	
   7	
  
Service Locator
•  Container	
  for	
  storing	
  objects	
  or	
  condiNons	
  for	
  building	
  an	
  object	
  
•  Mostly	
  it’s	
  used	
  to	
  create	
  objects	
  
•  It	
  does	
  not	
  do	
  automaNc	
  dependency	
  injecNon	
  
•  It	
  is	
  not	
  global	
  (unless	
  you	
  make	
  it	
  global)	
  
ZendCon	
  2015	
   8	
  
What can we store in there?
•  Invokables	
  
•  Factories	
  
•  Abstract	
  Factories	
  
•  Delegators	
  
•  IniNalizers	
  
•  Aliases	
  
ZendCon	
  2015	
   9	
  
Standalone
$serviceManager	
  =	
  new	
  ZendServiceManagerServiceManager();	
  
$serviceManager-­‐>setService(‘MyService’,	
  $myService);	
  
	
  
$serviceManager-­‐>has(‘MyService’);	
  
$service	
  =	
  $serviceManager-­‐>get(‘MyService’);	
  
	
  
ZendCon	
  2015	
   10	
  
Built into ZF2 full-stack applications
•  Anything	
  that	
  is	
  ServiceLocatorAwareInterface	
  can	
  have	
  it	
  injected	
  
•  Controllers	
  are	
  the	
  most	
  common	
  
ZendCon	
  2015	
   11	
  
namespace	
  ApplicationController;	
  
	
  
use	
  ZendMvcControllerAbstractActionController;	
  
	
  
class	
  IndexController	
  extends	
  AbstractActionController	
  {	
  
	
  	
  	
  	
  public	
  function	
  indexAction()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $model	
  =	
  $this-­‐>getServiceLocator()-­‐>get(‘MyModel’);	
  
	
  	
  	
  	
  }	
  
}	
  
Stuff we can get from the Service Manager
ZendCon	
  2015	
   12	
  
Invokables
•  Any	
  sort	
  of	
  object	
  that	
  can	
  be	
  declared	
  with	
  ‘new’	
  and	
  has	
  no	
  
constructor	
  parameters	
  
ZendCon	
  2015	
   13	
  
class	
  MyClass	
  {	
  
	
  	
  	
  	
  public	
  function	
  foo()	
  {	
  ...	
  }	
  
	
  	
  	
  	
  public	
  function	
  bar()	
  {	
  ...	
  }	
  
}	
  
	
  
class	
  SimpleConstructor	
  {	
  
	
  	
  	
  	
  protected	
  $name;	
  
	
  	
  	
  	
  public	
  function	
  __construct()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $this-­‐>name	
  =	
  'baz';	
  
	
  	
  	
  	
  }	
  
}	
  
In ZF2
return	
  [	
  
	
  	
  	
  	
  'service_manager'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  'invokables'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'JobProcessorProcessorListener'	
  =>	
  'JobProcessorProcessorListener',	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'JobServiceAccountListener'	
  =>	
  'JobServiceJobServiceListener'	
  
	
  	
  	
  	
  	
  	
  	
  	
  ],	
  
	
  	
  	
  	
  ]	
  
]	
  
ZendCon	
  2015	
   14	
  
Quick Dependency Injection Tutorial
ZendCon	
  2015	
   15	
  
What is Dependency Injection?
•  InjecNng	
  dependencies	
  into	
  classes,	
  instead	
  of	
  having	
  the	
  class	
  create	
  
it	
  
•  Allows	
  for	
  much	
  easier	
  tesNng	
  
•  Allows	
  for	
  a	
  much	
  easier	
  Nme	
  swapping	
  out	
  code	
  
•  Reduces	
  the	
  coupling	
  that	
  happens	
  between	
  classes	
  
php[tek]	
  2015	
   16	
  
Method Injection
class	
  MapService	
  {	
  
	
  	
  	
  	
  public	
  function	
  getLatLong(GoogleMaps	
  $map,	
  $street,	
  $city,	
  $state)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $map-­‐>getLatLong($street	
  .	
  '	
  '	
  .	
  $city	
  .	
  '	
  '	
  .	
  $state);	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  public	
  function	
  getAddress(GoogleMaps	
  $map,	
  $lat,	
  $long)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $map-­‐>getAddress($lat,	
  $long);	
  
	
  	
  	
  	
  }	
  
}	
  
php[tek]	
  2015	
   17	
  
Constructor Injection
class	
  MapService	
  {	
  
	
  	
  	
  	
  protected	
  $map;	
  
	
  	
  	
  	
  public	
  function	
  __construct(GoogleMaps	
  $map)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $this-­‐>map	
  =	
  $map;	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  public	
  function	
  getLatLong($street,	
  $city,	
  $state)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $this	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  -­‐>map	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  -­‐>getLatLong($street	
  .	
  '	
  '	
  .	
  $city	
  .	
  '	
  '	
  .	
  $state);	
  
	
  	
  	
  	
  }	
  
}	
  
	
  
	
  	
  
php[tek]	
  2015	
   18	
  
Setter Injection
class	
  MapService	
  {	
  
	
  	
  	
  	
  protected	
  $map;	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  public	
  function	
  setMap(GoogleMaps	
  $map)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $this-­‐>map	
  =	
  $map;	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  public	
  function	
  getMap()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $this-­‐>map;	
  
	
  	
  	
  	
  }	
  
	
  	
  	
  	
  public	
  function	
  getLatLong($street,	
  $city,	
  $state)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $this-­‐>getMap()-­‐>getLatLong($street	
  .	
  '	
  '	
  .	
  $city	
  .	
  '	
  '	
  .	
  $state);	
  
	
  	
  	
  	
  }	
  
}	
  
	
  	
  
php[tek]	
  2015	
   19	
  
Back to the show
ZendCon	
  2015	
   20	
  
Factories
•  A	
  Factory	
  is	
  an	
  object/method	
  is	
  that	
  is	
  used	
  to	
  create	
  other	
  objects	
  
•  ZF2	
  Service	
  Manager	
  will	
  call	
  the	
  factory	
  when	
  an	
  object	
  is	
  pulled	
  out	
  
of	
  the	
  Service	
  Manager	
  
ZendCon	
  2015	
   21	
  
Why do we need factories?
Dependencies	
  
ZendCon	
  2015	
   22	
  
In ZF2
ZendCon	
  2015	
   23	
  
return	
  [	
  
	
  	
  	
  	
  'service_manager'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  ’factories'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  'GoogleAdWordsAdWordsUserBuilder'	
  =>	
  'GoogleAdWordsGoogleAdWordsUserBuilderFactory',	
  
	
  	
  	
  	
  	
  	
  	
  	
  ],	
  
	
  	
  	
  	
  ]	
  
]	
  
ZendCon	
  2015	
   24	
  
namespace	
  GoogleAdWords;	
  
	
  
class	
  GoogleAdWordsUserBuilder	
  
{	
  
	
  	
  	
  	
  public	
  function	
  __construct(array	
  $config)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $this-­‐>config	
  =	
  $config;	
  
	
  	
  	
  	
  }	
  
}	
  
	
  
ZendCon	
  2015	
   25	
  
namespace	
  GoogleAdWords;	
  
	
  
use	
  ZendServiceManagerFactoryInterface;	
  
use	
  ZendServiceManagerServiceLocatorInterface;	
  
	
  
class	
  GoogleAdWordsUserBuilderFactory	
  implements	
  FactoryInterface	
  
{	
  
	
  	
  	
  	
  public	
  function	
  createService(ServiceLocatorInterface	
  $service)	
  
	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $config	
  =	
  $service-­‐>get('Config');	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  new	
  GoogleAdWordsUserBuilder($config[‘google’]);	
  
	
  	
  	
  	
  }	
  
}	
  
	
  
Abstract Factories
•  They	
  are	
  factories,	
  but	
  they	
  allow	
  the	
  creaNon	
  of	
  a	
  broad	
  range	
  of	
  
objects	
  instead	
  of	
  a	
  single	
  object	
  
•  The	
  factory	
  will	
  take	
  addiNonal	
  configuraNon	
  to	
  properly	
  create	
  the	
  
needed	
  object	
  
ZendCon	
  2015	
   26	
  
ZendCon	
  2015	
   27	
  
<?php	
  
	
  
namespace	
  MyProject;	
  
	
  
use	
  ZendDbTableGatewayTableGateway;	
  
use	
  ZendServiceManagerFactoryInterface;	
  
use	
  ZendServiceManagerServiceLocatorInterface;	
  
	
  
class	
  ProjectsTableFactory	
  implements	
  FactoryInterface	
  {	
  
	
  	
  	
  	
  public	
  function	
  createService(ServiceLocatorInterface	
  $serviceLocator)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $adapter	
  =	
  new	
  $serviceLocator-­‐>get('ZendDbAdapterAdapter');	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  new	
  TableGateway('projects',	
  $adapter);	
  
	
  	
  	
  	
  }	
  
}	
  
	
  
class	
  CategoriesTableFactory	
  implements	
  FactoryInterface	
  {	
  
	
  	
  	
  	
  public	
  function	
  createService(ServiceLocatorInterface	
  $serviceLocator)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $adapter	
  =	
  new	
  $serviceLocator-­‐>get('ZendDbAdapterAdapter');	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  new	
  TableGateway('categories',	
  $adapter);	
  
	
  	
  	
  	
  }	
  
}	
  
In ZF2
ZendCon	
  2015	
   28	
  
return	
  [	
  
	
  	
  	
  	
  ’abstract_factories'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  ’MyProjectTableAbstractFactory’	
  
	
  	
  	
  	
  ]	
  
]	
  
ZendCon	
  2015	
   29	
  
<?php	
  
	
  
namespace	
  MyProject;	
  
	
  
use	
  ZendDbTableGatewayTableGateway;	
  
use	
  ZendServiceManagerAbstractFactoryInterface;	
  
use	
  ZendServiceManagerServiceLocatorInterface;	
  
	
  
class	
  TableAbstractFactory	
  implements	
  AbstractFactoryInterface	
  {	
  
	
  	
  	
  	
  public	
  function	
  canCreateServiceWithName(ServiceLocatorInterface	
  $sl,	
  $name,	
  $requestedName)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  preg_match("/Table$/",	
  $requestedName);	
  
	
  	
  	
  	
  }	
  
	
  
	
  	
  	
  	
  public	
  function	
  createServiceWithName(ServiceLocatorInterface	
  $sl,	
  $name,	
  $requestedName)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $adapter	
  =	
  $sl-­‐>get('ZendDbAdapterAdapter');	
  
	
  	
  	
  	
  	
  	
  	
  	
  $tableName	
  =	
  str_replace('Table',	
  '',	
  $requestedName);	
  
	
  	
  	
  	
  	
  	
  	
  	
  $tableName	
  =	
  strtolower($tableName);	
  
	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  new	
  TableGateway($tableName,	
  $adapter);	
  
	
  	
  	
  	
  }	
  
}	
  
Initializers
•  Code	
  that	
  needs	
  to	
  run	
  ajer	
  an	
  object	
  is	
  created	
  
•  Really	
  helpful	
  for	
  when	
  lots	
  of	
  objects	
  need	
  addiNonal	
  objects	
  (like	
  
loggers)	
  all	
  across	
  the	
  applicaNon	
  
ZendCon	
  2015	
   30	
  
In ZF2
ZendCon	
  2015	
   31	
  
return	
  [	
  
	
  	
  	
  	
  ’initalizers'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  ’JobServiceJobServiceAwareInitializer’	
  
	
  	
  	
  	
  ]	
  
]	
  
ZendCon	
  2015	
   32	
  
<?php	
  
	
  
namespace	
  JobService;	
  
	
  
use	
  ZendServiceManagerInitializerInterface;	
  
use	
  ZendServiceManagerServiceLocatorAwareInterface;	
  
use	
  ZendServiceManagerServiceLocatorInterface;	
  
	
  
class	
  JobServiceAwareInitializer	
  implements	
  InitializerInterface	
  
{	
  
	
  	
  	
  	
  public	
  function	
  initialize($instance,	
  ServiceLocatorInterface	
  $serviceLocator)	
  
	
  	
  	
  	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  if	
  (!$instance	
  instanceof	
  JobServiceAwareInterface)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  null;	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  
	
  
	
  	
  	
  	
  	
  	
  	
  	
  /**	
  @var	
  JobServiceJobService	
  $jobService	
  */	
  
	
  	
  	
  	
  	
  	
  	
  	
  $jobService	
  =	
  $serviceLocator-­‐>get('JobService');	
  
	
  
	
  	
  	
  	
  	
  	
  	
  	
  $instance-­‐>setJobService($jobService);	
  
	
  	
  	
  	
  }	
  
}	
  
	
  
Delegators
•  They	
  are	
  actually	
  decorators	
  for	
  objects	
  that	
  don’t	
  exist	
  
•  They	
  are	
  like	
  iniNalizers	
  that	
  only	
  run	
  on	
  a	
  specific	
  key	
  
•  Allow	
  your	
  applicaNon	
  to	
  tweak	
  or	
  modify	
  3rd	
  party	
  objects	
  without	
  
having	
  to	
  extend	
  them	
  
ZendCon	
  2015	
   33	
  
In ZF2
ZendCon	
  2015	
   34	
  
return	
  [	
  
	
  	
  	
  	
  ’delgators'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  ’OtherVendorAccountAccountService’	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ‘MyProjectAccountAccountServiceDelegator’,	
  
	
  	
  	
  	
  	
  	
  	
  	
  ]	
  
	
  	
  	
  	
  ]	
  
]	
  
ZendCon	
  2015	
   35	
  
<?php	
  
	
  
namespace	
  MyProject;	
  
	
  
use	
  ZendServiceManagerDelegatorFactoryInterface;	
  
use	
  ZendServiceManagerServiceLocatorInterface;	
  
	
  
class	
  AccountServiceDelegator	
  implements	
  DelegatorFactoryInterface	
  {	
  
	
  	
  	
  	
  public	
  function	
  createDelegatorWithName(ServiceLocatorInterface	
  $sl,	
  $name,	
  $requestedName,	
  
$callback)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  $originalService	
  =	
  $callback();	
  
	
  	
  	
  	
  	
  	
  	
  	
  $accountService	
  =	
  new	
  MyProjectAccountAccountService($originalService);	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $accountService;	
  
	
  	
  	
  	
  }	
  
}	
  
Aliases
•  Just	
  another	
  name	
  for	
  some	
  other	
  key	
  in	
  the	
  service	
  manager	
  
ZendCon	
  2015	
   36	
  
In ZF2
ZendCon	
  2015	
   37	
  
return	
  [	
  
	
  	
  	
  	
  ’aliases'	
  =>	
  [	
  
	
  	
  	
  	
  	
  	
  	
  	
  ’MyProjectAccountOldAccountService’	
  =>	
  ‘MyProjectAccountNewAccountService’,	
  
	
  	
  	
  	
  ]	
  
]	
  
Bad Practices
ZendCon	
  2015	
   38	
  
Lots of Initializers
•  IniNalizers	
  run	
  ajer	
  every	
  object	
  is	
  created	
  
•  30	
  iniNalizers	
  *	
  50	
  objects	
  created	
  at	
  runNme	
  =	
  	
  1500	
  invocaNons	
  
•  Look	
  at	
  using	
  Factories	
  instead	
  to	
  inject	
  things	
  into	
  your	
  objects	
  
•  Look	
  at	
  using	
  Delegators	
  
ZendCon	
  2015	
   39	
  
Functions as Factories
•  The	
  Factory	
  system	
  will	
  actually	
  take	
  any	
  invokable	
  thing	
  as	
  a	
  factory	
  
•  That	
  means	
  you	
  can	
  use	
  closures	
  and	
  anonymous	
  classes	
  
ZendCon	
  2015	
   40	
  
ZendCon	
  2015	
   41	
  
return	
  [	
  
	
  	
  	
  	
  'factories'	
  =>	
  array(	
  
	
  	
  	
  	
  	
  	
  	
  	
  'CategoryService'	
  =>	
  function($sm)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $categoryService	
  =	
  new	
  CategoryService();	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $categoryService-­‐>setCategoryTable($sm-­‐>get('CategoryTable'));	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  $categoryService;	
  
	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  'CategoryTable'	
  =>	
  function($sm)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $tableGateway	
  =	
  $sm-­‐>get('CategoryTableGateway');	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $table	
  =	
  new	
  CategoryTable($tableGateway);	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  $table;	
  
	
  	
  	
  	
  	
  	
  	
  	
  },	
  
	
  	
  	
  	
  	
  	
  	
  	
  'CategoryTableGateway'	
  =>	
  function($sm)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $dbAdapter	
  =	
  $sm-­‐>get('ZendDbAdapterAdapter');	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $resultSetPrototype	
  =	
  new	
  ResultSet();	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  $resultSetPrototype-­‐>setArrayObjectPrototype(new	
  Category());	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  new	
  TableGateway('category',	
  $dbAdapter,	
  null,	
  $resultSetPrototype);	
  
	
  	
  	
  	
  	
  	
  	
  	
  },	
  
]	
  
Functions as Factories
•  This	
  makes	
  the	
  config	
  uncachable,	
  so	
  there	
  are	
  performance	
  issues	
  
ZendCon	
  2015	
   42	
  
Questions?
ZendCon	
  2015	
   43	
  
Thank You!
hBp://ctankersley.com	
  
chris@ctankersley.com	
  
@dragonmantank	
  
	
  
hBp://joind.in/talk/view/15534	
  
ZendCon	
  2015	
   44	
  

More Related Content

What's hot

Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in rubyHiroshi Nakamura
 
Autoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadAutoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadBram Vogelaar
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stackBram Vogelaar
 
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...dantleech
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby CoreHiroshi SHIBATA
 
Practical PHP 5.3
Practical PHP 5.3Practical PHP 5.3
Practical PHP 5.3Nate Abele
 
Bootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stackBootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stackBram Vogelaar
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellSalaudeen Rajack
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
How to do everything with PowerShell
How to do everything with PowerShellHow to do everything with PowerShell
How to do everything with PowerShellJuan Carlos Gonzalez
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherMichele Orselli
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)Ontico
 
PowerShell: Automation for everyone
PowerShell: Automation for everyonePowerShell: Automation for everyone
PowerShell: Automation for everyoneGavin Barron
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in GolangBo-Yi Wu
 

What's hot (20)

Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
 
Autoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomadAutoscaling with hashi_corp_nomad
Autoscaling with hashi_corp_nomad
 
Bootstrapping multidc observability stack
Bootstrapping multidc observability stackBootstrapping multidc observability stack
Bootstrapping multidc observability stack
 
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
Building and Incredible Machine with Pipelines and Generators in PHP (IPC Ber...
 
Practical Testing of Ruby Core
Practical Testing of Ruby CorePractical Testing of Ruby Core
Practical Testing of Ruby Core
 
Introduction to Flask Micro Framework
Introduction to Flask Micro FrameworkIntroduction to Flask Micro Framework
Introduction to Flask Micro Framework
 
Practical PHP 5.3
Practical PHP 5.3Practical PHP 5.3
Practical PHP 5.3
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
RxSwift to Combine
RxSwift to CombineRxSwift to Combine
RxSwift to Combine
 
Bootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stackBootstrap your Cloud Infrastructure using puppet and hashicorp stack
Bootstrap your Cloud Infrastructure using puppet and hashicorp stack
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
RxSwift to Combine
RxSwift to CombineRxSwift to Combine
RxSwift to Combine
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
How to do everything with PowerShell
How to do everything with PowerShellHow to do everything with PowerShell
How to do everything with PowerShell
 
Hopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to anotherHopping in clouds: a tale of migration from one cloud provider to another
Hopping in clouds: a tale of migration from one cloud provider to another
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
HHVM: Efficient and Scalable PHP/Hack Execution / Guilherme Ottoni (Facebook)
 
PowerShell: Automation for everyone
PowerShell: Automation for everyonePowerShell: Automation for everyone
PowerShell: Automation for everyone
 
Job Queue in Golang
Job Queue in GolangJob Queue in Golang
Job Queue in Golang
 

Viewers also liked

Talk no Meetup LaravelSP #3
Talk no Meetup LaravelSP #3Talk no Meetup LaravelSP #3
Talk no Meetup LaravelSP #3Wellington Silva
 
Docker para deploy de aplicação
Docker para deploy de aplicaçãoDocker para deploy de aplicação
Docker para deploy de aplicaçãoMundo Docker
 
Blue Green Deployment com Docker
Blue Green Deployment com DockerBlue Green Deployment com Docker
Blue Green Deployment com DockerPedro Cavalheiro
 
Da Integração Contínua à Entrega Contínua apenas com ferramentas open-source
Da Integração Contínua à Entrega Contínua apenas com ferramentas open-sourceDa Integração Contínua à Entrega Contínua apenas com ferramentas open-source
Da Integração Contínua à Entrega Contínua apenas com ferramentas open-sourceRaphael Paiva
 
Asset management with Zend Framework 2
Asset management with Zend Framework 2Asset management with Zend Framework 2
Asset management with Zend Framework 2Stefano Valle
 
Implementing access control with zend framework
Implementing access control with zend frameworkImplementing access control with zend framework
Implementing access control with zend frameworkGeorge Mihailov
 
Error Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingError Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingSteve Maraspin
 
O poder do Docker (7 Masters)
O poder do Docker (7 Masters)O poder do Docker (7 Masters)
O poder do Docker (7 Masters)Wellington Silva
 
Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Stefano Valle
 
Unit testing PHP apps with PHPUnit
Unit testing PHP apps with PHPUnitUnit testing PHP apps with PHPUnit
Unit testing PHP apps with PHPUnitMichelangelo van Dam
 
Zend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency InjectionZend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency InjectionAbdul Malik Ikhsan
 
Oito dicas sobre Docker
Oito dicas sobre DockerOito dicas sobre Docker
Oito dicas sobre DockerMundo Docker
 
DevOps utilizando Docker
DevOps utilizando DockerDevOps utilizando Docker
DevOps utilizando Dockerthdotnet
 
DevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia II
DevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia IIDevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia II
DevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia IIAlefe Variani
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentationThanh Robi
 
Automatizando a implantação e operação de aplicações conteinerizadas no...
Automatizando a implantação e operação de aplicações conteinerizadas no...Automatizando a implantação e operação de aplicações conteinerizadas no...
Automatizando a implantação e operação de aplicações conteinerizadas no...Elo7
 
Deploying Docker Containers
Deploying Docker ContainersDeploying Docker Containers
Deploying Docker ContainersHugo Henley
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test PatternsFrank Appel
 

Viewers also liked (20)

Talk no Meetup LaravelSP #3
Talk no Meetup LaravelSP #3Talk no Meetup LaravelSP #3
Talk no Meetup LaravelSP #3
 
Alagoas Dev Day
Alagoas Dev DayAlagoas Dev Day
Alagoas Dev Day
 
Docker para deploy de aplicação
Docker para deploy de aplicaçãoDocker para deploy de aplicação
Docker para deploy de aplicação
 
Blue Green Deployment com Docker
Blue Green Deployment com DockerBlue Green Deployment com Docker
Blue Green Deployment com Docker
 
Da Integração Contínua à Entrega Contínua apenas com ferramentas open-source
Da Integração Contínua à Entrega Contínua apenas com ferramentas open-sourceDa Integração Contínua à Entrega Contínua apenas com ferramentas open-source
Da Integração Contínua à Entrega Contínua apenas com ferramentas open-source
 
Asset management with Zend Framework 2
Asset management with Zend Framework 2Asset management with Zend Framework 2
Asset management with Zend Framework 2
 
Implementing access control with zend framework
Implementing access control with zend frameworkImplementing access control with zend framework
Implementing access control with zend framework
 
Zend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnitZend Framework 2 - PHPUnit
Zend Framework 2 - PHPUnit
 
Error Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, loggingError Reporting in ZF2: form messages, custom error pages, logging
Error Reporting in ZF2: form messages, custom error pages, logging
 
O poder do Docker (7 Masters)
O poder do Docker (7 Masters)O poder do Docker (7 Masters)
O poder do Docker (7 Masters)
 
Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2Instant ACLs with Zend Framework 2
Instant ACLs with Zend Framework 2
 
Unit testing PHP apps with PHPUnit
Unit testing PHP apps with PHPUnitUnit testing PHP apps with PHPUnit
Unit testing PHP apps with PHPUnit
 
Zend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency InjectionZend Framework 2 : Dependency Injection
Zend Framework 2 : Dependency Injection
 
Oito dicas sobre Docker
Oito dicas sobre DockerOito dicas sobre Docker
Oito dicas sobre Docker
 
DevOps utilizando Docker
DevOps utilizando DockerDevOps utilizando Docker
DevOps utilizando Docker
 
DevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia II
DevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia IIDevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia II
DevOps II - Ambientes padronizados e Monitoramento da Aplicação | Monografia II
 
PHPUnit best practices presentation
PHPUnit best practices presentationPHPUnit best practices presentation
PHPUnit best practices presentation
 
Automatizando a implantação e operação de aplicações conteinerizadas no...
Automatizando a implantação e operação de aplicações conteinerizadas no...Automatizando a implantação e operação de aplicações conteinerizadas no...
Automatizando a implantação e operação de aplicações conteinerizadas no...
 
Deploying Docker Containers
Deploying Docker ContainersDeploying Docker Containers
Deploying Docker Containers
 
Clean Unit Test Patterns
Clean Unit Test PatternsClean Unit Test Patterns
Clean Unit Test Patterns
 

Similar to Into the ZF2 Service Manager

Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework FoundationsChuck Reeves
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperGary Hockin
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic ComponentsMateusz Tymek
 
Key Insights into Development Design Patterns for Magento 2 - Magento Live UK
Key Insights into Development Design Patterns for Magento 2 - Magento Live UKKey Insights into Development Design Patterns for Magento 2 - Magento Live UK
Key Insights into Development Design Patterns for Magento 2 - Magento Live UKMax Pronko
 
"Angular.js Concepts in Depth" by Aleksandar Simović
"Angular.js Concepts in Depth" by Aleksandar Simović"Angular.js Concepts in Depth" by Aleksandar Simović
"Angular.js Concepts in Depth" by Aleksandar SimovićJS Belgrade
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf Conference
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenchesLukas Smith
 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodeSWIFTotter Solutions
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormMichelangelo van Dam
 
Laravel Design Patterns
Laravel Design PatternsLaravel Design Patterns
Laravel Design PatternsBobby Bouwmann
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the TrenchesJonathan Wage
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuningAOE
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
ngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency InjectionngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency InjectionDzmitry Ivashutsin
 
Real World Dependency Injection - phpday
Real World Dependency Injection - phpdayReal World Dependency Injection - phpday
Real World Dependency Injection - phpdayStephan Hochdörfer
 
Introduction to Zend framework
Introduction to Zend framework Introduction to Zend framework
Introduction to Zend framework Matteo Magni
 
Nagios Conference 2012 - Dave Josephsen - Stop Being Lazy
Nagios Conference 2012 - Dave Josephsen - Stop Being LazyNagios Conference 2012 - Dave Josephsen - Stop Being Lazy
Nagios Conference 2012 - Dave Josephsen - Stop Being LazyNagios
 
Getting up & running with zend framework
Getting up & running with zend frameworkGetting up & running with zend framework
Getting up & running with zend frameworkSaidur Rahman
 

Similar to Into the ZF2 Service Manager (20)

Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework Foundations
 
ZF2 for the ZF1 Developer
ZF2 for the ZF1 DeveloperZF2 for the ZF1 Developer
ZF2 for the ZF1 Developer
 
Complex Sites with Silex
Complex Sites with SilexComplex Sites with Silex
Complex Sites with Silex
 
Zend Framework 2 - Basic Components
Zend Framework 2  - Basic ComponentsZend Framework 2  - Basic Components
Zend Framework 2 - Basic Components
 
Key Insights into Development Design Patterns for Magento 2 - Magento Live UK
Key Insights into Development Design Patterns for Magento 2 - Magento Live UKKey Insights into Development Design Patterns for Magento 2 - Magento Live UK
Key Insights into Development Design Patterns for Magento 2 - Magento Live UK
 
"Angular.js Concepts in Depth" by Aleksandar Simović
"Angular.js Concepts in Depth" by Aleksandar Simović"Angular.js Concepts in Depth" by Aleksandar Simović
"Angular.js Concepts in Depth" by Aleksandar Simović
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
 
Symfony2 - from the trenches
Symfony2 - from the trenchesSymfony2 - from the trenches
Symfony2 - from the trenches
 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better Code
 
Quality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStormQuality assurance for php projects with PHPStorm
Quality assurance for php projects with PHPStorm
 
Hexagonal architecture
Hexagonal architectureHexagonal architecture
Hexagonal architecture
 
Laravel Design Patterns
Laravel Design PatternsLaravel Design Patterns
Laravel Design Patterns
 
Symfony2 from the Trenches
Symfony2 from the TrenchesSymfony2 from the Trenches
Symfony2 from the Trenches
 
Performance measurement and tuning
Performance measurement and tuningPerformance measurement and tuning
Performance measurement and tuning
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
ngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency InjectionngMess: AngularJS Dependency Injection
ngMess: AngularJS Dependency Injection
 
Real World Dependency Injection - phpday
Real World Dependency Injection - phpdayReal World Dependency Injection - phpday
Real World Dependency Injection - phpday
 
Introduction to Zend framework
Introduction to Zend framework Introduction to Zend framework
Introduction to Zend framework
 
Nagios Conference 2012 - Dave Josephsen - Stop Being Lazy
Nagios Conference 2012 - Dave Josephsen - Stop Being LazyNagios Conference 2012 - Dave Josephsen - Stop Being Lazy
Nagios Conference 2012 - Dave Josephsen - Stop Being Lazy
 
Getting up & running with zend framework
Getting up & running with zend frameworkGetting up & running with zend framework
Getting up & running with zend framework
 

More from Chris Tankersley

Docker is Dead: Long Live Containers
Docker is Dead: Long Live ContainersDocker is Dead: Long Live Containers
Docker is Dead: Long Live ContainersChris Tankersley
 
Bend time to your will with git
Bend time to your will with gitBend time to your will with git
Bend time to your will with gitChris Tankersley
 
Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Chris Tankersley
 
Dead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPIDead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPIChris Tankersley
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for DevelopmentChris Tankersley
 
Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Chris Tankersley
 
BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018Chris Tankersley
 
You Were Lied To About Optimization
You Were Lied To About OptimizationYou Were Lied To About Optimization
You Were Lied To About OptimizationChris Tankersley
 
Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Chris Tankersley
 
Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Chris Tankersley
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Chris Tankersley
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Chris Tankersley
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017Chris Tankersley
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017Chris Tankersley
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPChris Tankersley
 
Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016Chris Tankersley
 
How We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceHow We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceChris Tankersley
 

More from Chris Tankersley (20)

Docker is Dead: Long Live Containers
Docker is Dead: Long Live ContainersDocker is Dead: Long Live Containers
Docker is Dead: Long Live Containers
 
Bend time to your will with git
Bend time to your will with gitBend time to your will with git
Bend time to your will with git
 
Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)Using PHP Functions! (Not those functions, Google Cloud Functions)
Using PHP Functions! (Not those functions, Google Cloud Functions)
 
Dead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPIDead Simple APIs with OpenAPI
Dead Simple APIs with OpenAPI
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
You Got Async in my PHP!
You Got Async in my PHP!You Got Async in my PHP!
You Got Async in my PHP!
 
Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018Docker for Developers - PHP Detroit 2018
Docker for Developers - PHP Detroit 2018
 
Docker for Developers
Docker for DevelopersDocker for Developers
Docker for Developers
 
They are Watching You
They are Watching YouThey are Watching You
They are Watching You
 
BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018BASHing at the CLI - Midwest PHP 2018
BASHing at the CLI - Midwest PHP 2018
 
You Were Lied To About Optimization
You Were Lied To About OptimizationYou Were Lied To About Optimization
You Were Lied To About Optimization
 
Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017Docker for PHP Developers - php[world] 2017
Docker for PHP Developers - php[world] 2017
 
Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017Docker for PHP Developers - Madison PHP 2017
Docker for PHP Developers - Madison PHP 2017
 
Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017Docker for Developers - php[tek] 2017
Docker for Developers - php[tek] 2017
 
Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017Why Docker? Dayton PHP, April 2017
Why Docker? Dayton PHP, April 2017
 
OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017OOP Is More Then Cars and Dogs - Midwest PHP 2017
OOP Is More Then Cars and Dogs - Midwest PHP 2017
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHP
 
Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016Coming to Terms with OOP In Drupal - php[world] 2016
Coming to Terms with OOP In Drupal - php[world] 2016
 
How We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open SourceHow We Got Here: A Brief History of Open Source
How We Got Here: A Brief History of Open Source
 

Recently uploaded

NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 

Recently uploaded (20)

NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 

Into the ZF2 Service Manager

  • 1. Into the ZF2 Service Manager Chris  Tankersley   ZendCon  2015   ZendCon  2015   1  
  • 2. Who Am I •  PHP  Programmer  for  over  10  years   •  Been  using  ZF  since  ~0.5   •  Daily  ZF2  user   •  hBps://github.com/dragonmantank   ZendCon  2015   2  
  • 3. A running joke… •  “Symfony2  is  a  PHP  script  that  turns  YAML  into  applicaNons”   •  “Yeah,  but  Zend  Framework  2  is  a  PHP  script  that  turns  arrays  into   applicaNons”   ZendCon  2015   3  
  • 5. It kind of is… ZendCon  2015   5   return  [          'service_manager'  =>  [                  'initializers'  =>  [                          'JobServiceJobServiceAwareInitializer'                  ],                  'invokables'  =>  [                          'JobProcessorListener'  =>  'JobProcessorProcessorListener',                          'JobServiceAccountListener'  =>  'JobServiceJobServiceListener’                      ],                  'factories'  =>  [                          'JobService'                      =>  'JobServiceJobServiceFactory',                          'JobProcessor'                  =>  'JobProcessorProcessorFactory',                  ]          ]   ]  
  • 6. Theater Magic •  When  something  awesome  happens,  but  it’s  really  something   mundane  controlling  it  in  the  background   •  When  it  looks  good  from  25’   ZendCon  2015   6  
  • 8. Service Locator •  Container  for  storing  objects  or  condiNons  for  building  an  object   •  Mostly  it’s  used  to  create  objects   •  It  does  not  do  automaNc  dependency  injecNon   •  It  is  not  global  (unless  you  make  it  global)   ZendCon  2015   8  
  • 9. What can we store in there? •  Invokables   •  Factories   •  Abstract  Factories   •  Delegators   •  IniNalizers   •  Aliases   ZendCon  2015   9  
  • 10. Standalone $serviceManager  =  new  ZendServiceManagerServiceManager();   $serviceManager-­‐>setService(‘MyService’,  $myService);     $serviceManager-­‐>has(‘MyService’);   $service  =  $serviceManager-­‐>get(‘MyService’);     ZendCon  2015   10  
  • 11. Built into ZF2 full-stack applications •  Anything  that  is  ServiceLocatorAwareInterface  can  have  it  injected   •  Controllers  are  the  most  common   ZendCon  2015   11   namespace  ApplicationController;     use  ZendMvcControllerAbstractActionController;     class  IndexController  extends  AbstractActionController  {          public  function  indexAction()  {                  $model  =  $this-­‐>getServiceLocator()-­‐>get(‘MyModel’);          }   }  
  • 12. Stuff we can get from the Service Manager ZendCon  2015   12  
  • 13. Invokables •  Any  sort  of  object  that  can  be  declared  with  ‘new’  and  has  no   constructor  parameters   ZendCon  2015   13   class  MyClass  {          public  function  foo()  {  ...  }          public  function  bar()  {  ...  }   }     class  SimpleConstructor  {          protected  $name;          public  function  __construct()  {                  $this-­‐>name  =  'baz';          }   }  
  • 14. In ZF2 return  [          'service_manager'  =>  [                  'invokables'  =>  [                          'JobProcessorProcessorListener'  =>  'JobProcessorProcessorListener',                          'JobServiceAccountListener'  =>  'JobServiceJobServiceListener'                  ],          ]   ]   ZendCon  2015   14  
  • 15. Quick Dependency Injection Tutorial ZendCon  2015   15  
  • 16. What is Dependency Injection? •  InjecNng  dependencies  into  classes,  instead  of  having  the  class  create   it   •  Allows  for  much  easier  tesNng   •  Allows  for  a  much  easier  Nme  swapping  out  code   •  Reduces  the  coupling  that  happens  between  classes   php[tek]  2015   16  
  • 17. Method Injection class  MapService  {          public  function  getLatLong(GoogleMaps  $map,  $street,  $city,  $state)  {                  return  $map-­‐>getLatLong($street  .  '  '  .  $city  .  '  '  .  $state);          }                    public  function  getAddress(GoogleMaps  $map,  $lat,  $long)  {                  return  $map-­‐>getAddress($lat,  $long);          }   }   php[tek]  2015   17  
  • 18. Constructor Injection class  MapService  {          protected  $map;          public  function  __construct(GoogleMaps  $map)  {                  $this-­‐>map  =  $map;          }          public  function  getLatLong($street,  $city,  $state)  {                  return  $this                          -­‐>map                          -­‐>getLatLong($street  .  '  '  .  $city  .  '  '  .  $state);          }   }         php[tek]  2015   18  
  • 19. Setter Injection class  MapService  {          protected  $map;                    public  function  setMap(GoogleMaps  $map)  {                  $this-­‐>map  =  $map;          }          public  function  getMap()  {                  return  $this-­‐>map;          }          public  function  getLatLong($street,  $city,  $state)  {                  return  $this-­‐>getMap()-­‐>getLatLong($street  .  '  '  .  $city  .  '  '  .  $state);          }   }       php[tek]  2015   19  
  • 20. Back to the show ZendCon  2015   20  
  • 21. Factories •  A  Factory  is  an  object/method  is  that  is  used  to  create  other  objects   •  ZF2  Service  Manager  will  call  the  factory  when  an  object  is  pulled  out   of  the  Service  Manager   ZendCon  2015   21  
  • 22. Why do we need factories? Dependencies   ZendCon  2015   22  
  • 23. In ZF2 ZendCon  2015   23   return  [          'service_manager'  =>  [                  ’factories'  =>  [                          'GoogleAdWordsAdWordsUserBuilder'  =>  'GoogleAdWordsGoogleAdWordsUserBuilderFactory',                  ],          ]   ]  
  • 24. ZendCon  2015   24   namespace  GoogleAdWords;     class  GoogleAdWordsUserBuilder   {          public  function  __construct(array  $config)  {                  $this-­‐>config  =  $config;          }   }    
  • 25. ZendCon  2015   25   namespace  GoogleAdWords;     use  ZendServiceManagerFactoryInterface;   use  ZendServiceManagerServiceLocatorInterface;     class  GoogleAdWordsUserBuilderFactory  implements  FactoryInterface   {          public  function  createService(ServiceLocatorInterface  $service)          {                  $config  =  $service-­‐>get('Config');                  return  new  GoogleAdWordsUserBuilder($config[‘google’]);          }   }    
  • 26. Abstract Factories •  They  are  factories,  but  they  allow  the  creaNon  of  a  broad  range  of   objects  instead  of  a  single  object   •  The  factory  will  take  addiNonal  configuraNon  to  properly  create  the   needed  object   ZendCon  2015   26  
  • 27. ZendCon  2015   27   <?php     namespace  MyProject;     use  ZendDbTableGatewayTableGateway;   use  ZendServiceManagerFactoryInterface;   use  ZendServiceManagerServiceLocatorInterface;     class  ProjectsTableFactory  implements  FactoryInterface  {          public  function  createService(ServiceLocatorInterface  $serviceLocator)  {                  $adapter  =  new  $serviceLocator-­‐>get('ZendDbAdapterAdapter');                  return  new  TableGateway('projects',  $adapter);          }   }     class  CategoriesTableFactory  implements  FactoryInterface  {          public  function  createService(ServiceLocatorInterface  $serviceLocator)  {                  $adapter  =  new  $serviceLocator-­‐>get('ZendDbAdapterAdapter');                  return  new  TableGateway('categories',  $adapter);          }   }  
  • 28. In ZF2 ZendCon  2015   28   return  [          ’abstract_factories'  =>  [                  ’MyProjectTableAbstractFactory’          ]   ]  
  • 29. ZendCon  2015   29   <?php     namespace  MyProject;     use  ZendDbTableGatewayTableGateway;   use  ZendServiceManagerAbstractFactoryInterface;   use  ZendServiceManagerServiceLocatorInterface;     class  TableAbstractFactory  implements  AbstractFactoryInterface  {          public  function  canCreateServiceWithName(ServiceLocatorInterface  $sl,  $name,  $requestedName)  {                  return  preg_match("/Table$/",  $requestedName);          }            public  function  createServiceWithName(ServiceLocatorInterface  $sl,  $name,  $requestedName)  {                  $adapter  =  $sl-­‐>get('ZendDbAdapterAdapter');                  $tableName  =  str_replace('Table',  '',  $requestedName);                  $tableName  =  strtolower($tableName);                    return  new  TableGateway($tableName,  $adapter);          }   }  
  • 30. Initializers •  Code  that  needs  to  run  ajer  an  object  is  created   •  Really  helpful  for  when  lots  of  objects  need  addiNonal  objects  (like   loggers)  all  across  the  applicaNon   ZendCon  2015   30  
  • 31. In ZF2 ZendCon  2015   31   return  [          ’initalizers'  =>  [                  ’JobServiceJobServiceAwareInitializer’          ]   ]  
  • 32. ZendCon  2015   32   <?php     namespace  JobService;     use  ZendServiceManagerInitializerInterface;   use  ZendServiceManagerServiceLocatorAwareInterface;   use  ZendServiceManagerServiceLocatorInterface;     class  JobServiceAwareInitializer  implements  InitializerInterface   {          public  function  initialize($instance,  ServiceLocatorInterface  $serviceLocator)          {                  if  (!$instance  instanceof  JobServiceAwareInterface)  {                          return  null;                  }                    /**  @var  JobServiceJobService  $jobService  */                  $jobService  =  $serviceLocator-­‐>get('JobService');                    $instance-­‐>setJobService($jobService);          }   }    
  • 33. Delegators •  They  are  actually  decorators  for  objects  that  don’t  exist   •  They  are  like  iniNalizers  that  only  run  on  a  specific  key   •  Allow  your  applicaNon  to  tweak  or  modify  3rd  party  objects  without   having  to  extend  them   ZendCon  2015   33  
  • 34. In ZF2 ZendCon  2015   34   return  [          ’delgators'  =>  [                  ’OtherVendorAccountAccountService’  =>  [                          ‘MyProjectAccountAccountServiceDelegator’,                  ]          ]   ]  
  • 35. ZendCon  2015   35   <?php     namespace  MyProject;     use  ZendServiceManagerDelegatorFactoryInterface;   use  ZendServiceManagerServiceLocatorInterface;     class  AccountServiceDelegator  implements  DelegatorFactoryInterface  {          public  function  createDelegatorWithName(ServiceLocatorInterface  $sl,  $name,  $requestedName,   $callback)  {                  $originalService  =  $callback();                  $accountService  =  new  MyProjectAccountAccountService($originalService);                                    return  $accountService;          }   }  
  • 36. Aliases •  Just  another  name  for  some  other  key  in  the  service  manager   ZendCon  2015   36  
  • 37. In ZF2 ZendCon  2015   37   return  [          ’aliases'  =>  [                  ’MyProjectAccountOldAccountService’  =>  ‘MyProjectAccountNewAccountService’,          ]   ]  
  • 39. Lots of Initializers •  IniNalizers  run  ajer  every  object  is  created   •  30  iniNalizers  *  50  objects  created  at  runNme  =    1500  invocaNons   •  Look  at  using  Factories  instead  to  inject  things  into  your  objects   •  Look  at  using  Delegators   ZendCon  2015   39  
  • 40. Functions as Factories •  The  Factory  system  will  actually  take  any  invokable  thing  as  a  factory   •  That  means  you  can  use  closures  and  anonymous  classes   ZendCon  2015   40  
  • 41. ZendCon  2015   41   return  [          'factories'  =>  array(                  'CategoryService'  =>  function($sm)  {                          $categoryService  =  new  CategoryService();                          $categoryService-­‐>setCategoryTable($sm-­‐>get('CategoryTable'));                          return  $categoryService;                  },                  'CategoryTable'  =>  function($sm)  {                          $tableGateway  =  $sm-­‐>get('CategoryTableGateway');                          $table  =  new  CategoryTable($tableGateway);                          return  $table;                  },                  'CategoryTableGateway'  =>  function($sm)  {                          $dbAdapter  =  $sm-­‐>get('ZendDbAdapterAdapter');                          $resultSetPrototype  =  new  ResultSet();                          $resultSetPrototype-­‐>setArrayObjectPrototype(new  Category());                          return  new  TableGateway('category',  $dbAdapter,  null,  $resultSetPrototype);                  },   ]  
  • 42. Functions as Factories •  This  makes  the  config  uncachable,  so  there  are  performance  issues   ZendCon  2015   42  
  • 44. Thank You! hBp://ctankersley.com   chris@ctankersley.com   @dragonmantank     hBp://joind.in/talk/view/15534   ZendCon  2015   44