2017 © Pedro Peláez
 

library tinyapp

Microframework for small command line applications.

image

iddqdby/tinyapp

Microframework for small command line applications.

  • Sunday, August 7, 2016
  • by iddqdby
  • Repository
  • 1 Watchers
  • 0 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Microframework for small command line applications

Build Status Latest Stable Version Total Downloads License, (*1)

Description

Install the library

To install the library, run composer require iddqdby/tinyapp., (*2)

Create an application

To create the application: * Extend abstract class TinyApp\App * Implement method init() to initialize your application * Implement method get($key) to get services and other stuff from any dependency injection container you like * Create a controller class that extends one of abstract classes in TinyApp\Controller namespace * Create public action methods like "somethingAction" * Define your controller in the dependency injection container under App::CONTROLLER_PREFIX.App::CONTROLLER_MAIN key * Use protected method get($key) inside your actions to get services and other stuff from your dependency injection container * Instantiate your app and call method $app->run($action, $arguments) to invoke an action once, or $app->loop() to run your application in interactive mode, (*3)

Example

Example of a script to run from CLI:, (*4)

<?php

require '/path/to/vendor/autoload.php';

$action = $argv[1];
$arguments = array_slice($argv, 2);

$app = new MyApp(); // MyApp extends TinyApp\App
$result = $app->run($action, $arguments);
printf("%s\n", $result);

The $action in the example above must match the regular expression "/((?<CONTROLLER>[\w\d\_]+):)?(?<ACTION>[\w\d\_]+)/i"., (*5)

Prefix App::CONTROLLER_PREFIX will be prepended to CONTROLLER. CONTROLLER will be set to App::CONTROLLER_MAIN if it is omitted., (*6)

Postfix App::ACTION_POSTFIX will be appended to ACTION., (*7)

The action of the controller will be invoked with passed arguments, and its result will be returned. The \BadMethodCallException exception will be thrown if no controller is registered under the given key, or if there is no such action in the controller., (*8)

Requirements

PHP 5.4 or later., (*9)

License

This program is licensed under the MIT License. See LICENSE., (*10)

The Versions

07/08 2016

1.2.x-dev

1.2.9999999.9999999-dev https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

07/08 2016

dev-master

9999999-dev https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

07/08 2016

v1.2.1

1.2.1.0 https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

07/08 2016

v1.2.0

1.2.0.0 https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

29/07 2016

v1.2.0-alpha1

1.2.0.0-alpha1 https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

29/07 2016

1.1.x-dev

1.1.9999999.9999999-dev https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

29/07 2016

v1.1.2

1.1.2.0 https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

17/06 2016

v1.1.1

1.1.1.0 https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

11/06 2016

v1.1.0

1.1.0.0 https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

28/02 2016

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line

28/02 2016

v1.0.0

1.0.0.0 https://github.com/iddqdby/tinyapp

Microframework for small command line applications.

  Sources   Download

MIT

The Requires

  • php ^5.4 || ^7.0

 

The Development Requires

by Sergey Protasevich

framework cli command line