2017 © Pedro Peláez
 

library controller

Invokeable controller that accepts containers, works with ETag and more

image

activecollab/controller

Invokeable controller that accepts containers, works with ETag and more

  • Friday, June 22, 2018
  • by ilijastuden
  • Repository
  • 3 Watchers
  • 0 Stars
  • 5,283 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 21 Versions
  • 9 % Grown

The README.md

Controller

Build Status, (*1)

Supported action responses:, (*2)

  1. \ActiveCollab\Controller\Response\FileDownloadResponse - streams a file download.
  2. \ActiveCollab\Controller\Response\StatusResponse - returns a HTTP status, without response body.
  3. \ActiveCollab\Controller\Response\ViewResponse - Renders a particular view.

When within a controller action, use these methods to get individual request parameters:, (*3)

  1. getParsedBodyParam()
  2. getCookieParam()
  3. getQueryParam()
  4. getServerParam()

All of these methods accept three parameters:, (*4)

  1. $request (\Psr\Http\Message\ServerRequestInterface instance)
  2. $param_name (string)
  3. $default (mixed, NULL by default)

Configuration

Controllers can override protected configure() method to do additional setup after controller construction. This method is separated from constructor, so developer does not need to inherit and manage complicated controller constructor., (*5)

<?php

namespace App;

use ActiveCollab\Controller\Controller;

class TestController extends Controller
{
    public $is_configured = false;

    protected function configure(): void
    {
        $this->is_configured = true;
    }
}

Exception Handling

When action fails due to an exception, system will return 500 HTTP error, with a message that does not expose any of the system details., (*6)

This is done in such a way that new RuntimeException is constructed, with generic error message, and real exception is passed as $previous constructor argument of the new exception. If you have your system configured so exceptions are fully described when 500 errors are rendered (in debug mode for example), you'll be able to access original exception detials like that., (*7)

To change default exception message, call setLogExceptionMessage() controller method:, (*8)

$controller->setLogExceptionMessage('Something weird happened: {exception}');

If $logger is added to the controller (during construction or later on), all exceptions that actions throw will be logged with error level., (*9)

To do

  1. Add $payload to status shortcut methods.

The Versions

22/06 2018

dev-master

9999999-dev

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

22/06 2018

0.10.18

0.10.18.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

22/06 2018

0.10.17

0.10.17.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

15/12 2017

0.10.16

0.10.16.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

25/11 2016

0.10.15

0.10.15.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

14/07 2016

0.10.14

0.10.14.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

11/07 2016

0.10.13

0.10.13.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

10/06 2016

0.10.12

0.10.12.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

10/06 2016

0.10.11

0.10.11.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

31/05 2016

0.10.10

0.10.10.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

25/05 2016

0.10.9

0.10.9.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

25/05 2016

0.10.8

0.10.8.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

25/05 2016

0.10.7

0.10.7.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

24/05 2016

0.10.6

0.10.6.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

22/05 2016

0.10.5

0.10.5.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

22/05 2016

0.10.4

0.10.4.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

18/05 2016

0.10.3

0.10.3.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

12/05 2016

0.10.2

0.10.2.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller

11/05 2016

0.10.1

0.10.1.0

Invokeable controller that accepts containers, works with ETag and more

  Sources   Download

MIT

The Requires

 

The Development Requires

controller