Gectrl PHP Generic Controller Class: Controller class that delegates in action classes

Recommend this page to a friend!
  Info   View files Documentation   View files View files (22)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2021-01-14 (5 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 30 This week: 29All time: 10,082 This week: 5Up
Version License PHP version Categories
gectrl 1.0GNU Lesser Genera...7Design Patterns, PHP 7
Description Author

This package implements a controller class that delegates the request handling in action classes.

It can register multiple classes that implement the actions for each of the supported request type by the controller.

The controller can handle the requests and forward it the respective action class that was previously registered.

Picture of Kjell-Inge Gustafsson
  Performance   Level  
Name: Kjell-Inge Gustafsson <contact>
Classes: 14 packages by
Country: Sweden Sweden
Age: ???
All time rank: 5262 in Sweden Sweden
Week rank: 7 Up1 in Sweden Sweden Up
Innovation award
Innovation award
Nominee: 4x

Details

[comment]: # (This file is part of Gectrl, PHP Genereric controller. Copyright 2021 Kjell-Inge Gustafsson, kigkonsult, All rights reserved, licence LGPLv3)

Gectrl

About

Gectrl is a PHP generic controller class package

  • Supports the MVC software design pattern
  • Distinguish controller and application logic using a strategy pattern

The controller provides coordination logic

The controller delegates application logic to actionClasses

  • using implementations of the (strategy) [ActionClassInterface],
  • invoking of actionClass condition evaluate and opt, logic doAction methods,
  • passing all data information in an encapsulated [Package] class instance * input, output, config, logger etc

Usage

Basic

Simpler (http/html) example

<?php
namespace Kigkonsult\Gectrl;
use ActionSrc\PrepAction;
use ActionSrc\CreateAction;
use ActionSrc\ReadAction;
use ActionSrc\UpdateAction;
use ActionSrc\DeleteAction;
use ActionSrc\CatchUpAction;
require 'vendor/autoload.php';

...

$package = Gectrl::init( $config, $logger )
    ->setActionClasses(
        [
            PrepAction::class,
            CreateAction::class,
            ReadAction::class,
            UpdateAction::class,
            DeleteAction::class,
            CatchUpAction::class,
        ]
    )
    ->main( $_REQUEST );
...

echo $package->getOutput();

For more detailed usage, read [Gectrl], [ActionClassInterface] and [Package] docs.

Installation

[Composer], from the Command Line:

composer require kigkonsult/gectrl

In your composer.json:

{
    "require": {
        "kigkonsult/gectrl": "dev-master"
    }
}

Sponsorship

Donation using [paypal.me/kigkonsult] are appreciated. For invoice, [e-mail]</a>.

Licence

Gectrl is licensed under the LGPLv3 License.

[ActionClassInterface]:docs/ActionClassInterface.md [Composer]:https://getcomposer.org/ [e-mail]:mailto:ical@kigkonsult.se [Gectrl]:docs/Gectrl.md [paypal.me/kigkonsult]:https://paypal.me/kigkonsult [Package]:docs/Package.md

  Files folder image Files  
File Role Description
Files folder image.github (1 file)
Files folder imagedocs (3 files)
Files folder imagesrc (3 files)
Files folder imagetest (2 files, 1 directory)
Accessible without login Plain text file autoload.php Aux. Auxiliary script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENCE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Read me

  Files folder image Files  /  .github  
File Role Description
  Accessible without login Plain text file FUNDING.yml Data Auxiliary data

  Files folder image Files  /  docs  
File Role Description
  Accessible without login Plain text file ActionClassInterface.md Data Auxiliary data
  Accessible without login Plain text file Gectrl.md Data Auxiliary data
  Accessible without login Plain text file Package.md Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file ActionClassInterface.php Class Class source
  Plain text file Gectrl.php Class Class source
  Plain text file Package.php Class Class source

  Files folder image Files  /  test  
File Role Description
Files folder imageAcSrc (8 files)
  Plain text file GectrlTest.php Class Class source
  Plain text file PackageTest.php Class Class source

  Files folder image Files  /  test  /  AcSrc  
File Role Description
  Plain text file Action0Base.php Class Class source
  Plain text file Action1Test.php Class Class source
  Plain text file Action3Test.php Class Class source
  Plain text file Action4Test.php Class Class source
  Plain text file ActionExampleTest.php Class Class source
  Plain text file OtherInterface.php Class Class source
  Plain text file OtherTest.php Class Class source
  Plain text file OtherTrait.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:30
This week:29
All time:10,082
This week:5Up

For more information send a message to info at phpclasses dot org.