2017 © Pedro Peláez
 

library php-flask

image

sebbekarlsson/php-flask

  • Friday, April 28, 2017
  • by sebbekarlsson
  • Repository
  • 3 Watchers
  • 11 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Flask for PHP!

Supports:

  • Blueprints
  • Function routes
  • Jinja-like templating (Using Twig)

Requirements:

  • PHP 5.6 and above
  • Composer

About

The goal of this project is to be able to write flask-like applications in PHP., (*1)

Installation

Clone down the repository inside your project, (*2)

And then:, (*3)

    cd PHPFlask/
    composer install

And then in your project:, (*4)

    require_once('PHPFlask/src/index.php');

Installing with composer

You can also install using composer:, (*5)

    composer install sebbekarlsson/php-flask

Full installation guide

Still clueless?, (*6)

Read the full installation guide, (*7)

Blueprint example:

    class FruitsBP extends Blueprint {
        var $fruits;

        function __construct() {
            parent::__construct();

            $this->base_url = '/fruits';

            $this->route('/', 'main');
        }

        function init() {
            $this->fruits = [
                'apple',
                'banana',
                'raspberry',
                'papaya',
                'orange'
            ];
        }

        function main() {
            return json_encode($this->fruits);
        }
    }

And then registering it:, (*8)

    $app->register_blueprint(new FruitsBP());

Function example:

    $app->route('/fruits', function() {
        return json_encode([
            'apple',
            'banana',
            'raspberry',
            'papaya',
            'orange'
        ]); 
    });

The Versions

28/04 2017

dev-master

9999999-dev

  Sources   Download

The Requires