Skip to content
Finds actions by HTTP method used on the request.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
_config
src Add basic tests Nov 13, 2019
tests
LICENSE
README.md
composer.json

README.md

Silverstripe Find HTTP Action

License Version

Trait for finding controller actions by HTTP method used on the request. Handy for building CRUD based Webservices. Can be used alongside the default action handling.

Requirements

  • Silverstripe 4.x

Installation

  • composer require level51/silverstripe-find-http-action
  • Flush config (flush=all)

Usage

use Level51\FindHTTPAction\FindHTTPAction;
use SilverStripe\Control\Controller;

class MyCRUDController extends Controller {

    use FindHTTPAction;

    ...
    
    private static $url_handlers = [
        'foo/$id'  => [
            'GET'    => 'getFooRecords',
            'POST'   => 'createFooRecord',
            'PUT'    => 'updateFooRecord',
            'DELETE' => 'deleteFooRecord'
        ],
        'bar/$id!' => [
            'PUT' => 'updateBarRecord'
        ],
        'about'    => 'myRegularAction
    ];
}

Maintainer

You can’t perform that action at this time.