Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebbekarlsson/phpflask
🍶 Flask for PHP
https://github.com/sebbekarlsson/phpflask
flask jinja2 mvc php php-flask php-framework php-library python routing twig
Last synced: about 13 hours ago
JSON representation
🍶 Flask for PHP
- Host: GitHub
- URL: https://github.com/sebbekarlsson/phpflask
- Owner: sebbekarlsson
- Created: 2017-04-16T15:14:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-09-10T08:11:14.000Z (over 5 years ago)
- Last Synced: 2024-12-31T10:05:24.792Z (about 1 month ago)
- Topics: flask, jinja2, mvc, php, php-flask, php-framework, php-library, python, routing, twig
- Language: PHP
- Homepage:
- Size: 346 KB
- Stars: 13
- Watchers: 5
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.## Installation
> Clone down the repository inside your project
> (preferably as a submodule)> And then:
cd PHPFlask/
composer install> And then in your project:
require_once('PHPFlask/src/index.php');
## Installing with composer
> You can also install using composer:composer install sebbekarlsson/php-flask
## Full installation guide
> Still clueless?> [Read the full installation guide](INSTALLATION.md)
## 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:
$app->register_blueprint(new FruitsBP());
## Function example:$app->route('/fruits', function() {
return json_encode([
'apple',
'banana',
'raspberry',
'papaya',
'orange'
]);
});