PHP code example of axis / axis-service-container-plugin

1. Go to this page and download the library: Download axis/axis-service-container-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

axis / axis-service-container-plugin example snippets




class MyBasicServiceImplementation implements MyService
{
  public function doSomething()
  {
    echo 'Yep. It works!';
  }
}

/** @var $myService MyService */
$myService = sfContext:getInstance()->get('my_service');
$myService->doSomething(); // echoes "Yep. It works!"

class MyParamServiceImplementation implements MyService
{
  protected $greating;

  public funciton __construct($greating = 'Yep. It works!')
  {
    $this->greating = $greating;
  }
  public function doSomething()
  {
    echo $this->greating;
  }
}

/** @var $myService MyService */
$myService = sfContext:getInstance()->get('my_service');
$myService->doSomething(); // echoes "Hooray!"

/** @var $services array */
$services = sfContext:getInstance()->get('#greater');
var_dump(array_map('get_class', $services)); 
// will output "array('MySimpleService', 'MyAdvancedService')"