PHPackages                             iddqdby/tinyapp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. iddqdby/tinyapp

ActiveLibrary[Framework](/categories/framework)

iddqdby/tinyapp
===============

Microframework for small command line applications.

v1.2.1(9y ago)022MITPHPPHP ^5.4 || ^7.0

Since Feb 28Pushed 9y ago1 watchersCompare

[ Source](https://github.com/iddqdby/tinyapp)[ Packagist](https://packagist.org/packages/iddqdby/tinyapp)[ Docs](https://github.com/iddqdby/tinyapp)[ RSS](/packages/iddqdby-tinyapp/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

Microframework for small command line applications
==================================================

[](#microframework-for-small-command-line-applications)

[![Build Status](https://camo.githubusercontent.com/9e3044dbb881c9ababaeb1bad3d7e5b29ec8b8ed6ffbe5b3dc1ca01d34baf1c8/68747470733a2f2f7472617669732d63692e6f72672f696464716462792f74696e796170702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/iddqdby/tinyapp)[![Latest Stable Version](https://camo.githubusercontent.com/a5a68e5d0e4bc6c9d3090ad05a928bce6e47896eb7a1d47cef518e65a33cdc1c/68747470733a2f2f706f7365722e707567782e6f72672f696464716462792f74696e796170702f762f737461626c65)](https://packagist.org/packages/iddqdby/tinyapp)[![Total Downloads](https://camo.githubusercontent.com/d30430f9dc9f4c15d68b31c27d5675fd870661a7ad832a010151dbdb76cc137e/68747470733a2f2f706f7365722e707567782e6f72672f696464716462792f74696e796170702f646f776e6c6f616473)](https://packagist.org/packages/iddqdby/tinyapp)[![License](https://camo.githubusercontent.com/87b46572d5b885554a4589670148e977daec990c8d0b6dcaf39ec2ef62deb69e/68747470733a2f2f706f7365722e707567782e6f72672f696464716462792f74696e796170702f6c6963656e7365)](https://packagist.org/packages/iddqdby/tinyapp)

Description
-----------

[](#description)

### Install the library

[](#install-the-library)

To install the library, run `composer require iddqdby/tinyapp`.

### Create an application

[](#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 "*something*Action"
- 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

### Example

[](#example)

Example of a script to run from CLI:

```
