vados/phalcon-http-methods-plugin

Phalcon plugin for checking access by HTTP Method of request

0.1 2019-01-04 10:44 UTC

This package is auto-updated.

Last update: 2024-04-25 07:18:34 UTC


README

Packagist PHP from Packagist Packagist GitHub Issues Scrutinizer Code Quality Travis CI Status

Phalcon plugin for checking access by HTTP Method of request.

You can select one or more HTTP methods for action availability from this: GET, POST, PUT, DELETE.

Works with PHP 7.1+

Usage

Plugin require availability 'Annotations' and 'Request' components in application DI container.

$dispatcher = new \Phalcon\Mvc\Dispatcher();
$eventManager = new \Phalcon\Events\Manager();
$eventManager->attach('dispatch:beforeExecuteRoute', new \Vados\PhalconPlugins\HTTPMethodsPlugin());
$dispatcher->setEventsManager($eventManager);

And just take annotations to controllers actions

class FooController extends \Phalcon\Mvc\Controller
{
    /**
     * @Method(GET, POST, PUT, DELETE)
     */
    public function barAction()
    {
        return 'foobar';
    }
}

Installation

Use composer for installation

composer require vados/phalcon-http-methods-plugin

Contribution guidelines

  • Writing tests
  • Code review
  • Guidelines accord