2017 © Pedro Peláez
 

library slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

image

teraone/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  • Friday, May 5, 2017
  • by teraone
  • Repository
  • 2 Watchers
  • 0 Stars
  • 770 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 9 Versions
  • 33 % Grown

The README.md

Build Status, (*1)

Slim 3 Framework CLI Request Middleware

This middleware will transform a CLI call into a GET Request. It is based on https://github.com/pavlakis/slim-cli but does not use the method paramter., (*2)

Add it with composer

composer require teraone/slim-cli

Pass the parameters in this order

route / query string, (*3)

php public/index.php /status event=true

Add it in the middleware section of your application

$app->add(new \Teraone\SlimCli\CliRequest());

Pass a route to test it with


$app->get('/status', 'YourNameSpace\YourController:yourMethod') ->setName('status');

Check you're only using a CLI call

final class YourController
{
    ...

    public function yourMethod(Request $request, Response $response, $args)
    {

        // ONLY WHEN CALLED THROUGH CLI
        if (PHP_SAPI !== 'cli') {
            return $response->withStatus(404)->withHeader('Location', '/404');
        }

        if (!$request->getParam('event')) {
            return $response->withStatus(404)->withHeader('Location', '/404');
        }

        ...

    }

}

Credits

Based on Bobby DeVeaux's (@bobbyjason) Gulp Skeleton, (*4)

The Versions

05/05 2017

dev-master

9999999-dev http://github.com/teraone/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

05/05 2017

2.0.0

2.0.0.0 http://github.com/teraone/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

14/03 2016

dev-no_method

dev-no_method http://github.com/pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

22/02 2016

1.0.3

1.0.3.0 http://github.com/pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

29/01 2016

1.0.2

1.0.2.0 http://github.com/pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

29/01 2016

dev-develop

dev-develop http://github.com/pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

29/01 2016

dev-arg-checks

dev-arg-checks http://github.com/pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

02/01 2016

1.0.1

1.0.1.0 http://github.com/pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim

28/12 2015

1.0

1.0.0.0 http://github.com/pavlakis/slim-cli

Making a mock GET request through the CLI and enabling the same application entry point on CLI scripts.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.5.0

 

The Development Requires

middleware framework cli slim