PHP code example of geggleto / setter-strategy

1. Go to this page and download the library: Download geggleto/setter-strategy 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/ */

    

geggleto / setter-strategy example snippets


class abcController {
  //...
  public function myAction (Request $request, Response $response, $args = []) {
    //..
  }
  //...
}

class abcController implements SetterInjectionReceiver {
  //.. Implement and store the Objects somewhere up here.
  //...
  public function myAction () {
    //..  This is now much more Slim 2 style
  }
  //...
}

class abcController implements SetterInjectionReceiver {
  //.. Implement and store the Objects somewhere up here.
  //...
  public function myAction ($arg1, $arg2, $arg3) {
    //..  This is now much more Slim 2 style
  }
  //...
}

// Setup the Strategy in the container by adding a factory method like below.
  $container['foundHandler'] = function ($c) {
      return new SetterInjectionStrategy();
  };