jasonmichels / lift-framework
Lift is a PHP 7 micro framework for building microservices
0.0.1
2016-06-07 15:18 UTC
Requires
- php: >=7.0
- nikic/fast-route: ^1.0
- psr/log: ^1.0
- symfony/http-foundation: ^3.0
Requires (Dev)
- halleck45/php-metrics: dev-master
- mockery/mockery: 0.9.*
- phing/phing: ^2.13
- phpmd/phpmd: @stable
- phpunit/phpunit: ^5.1
- sebastian/phpcpd: *
- squizlabs/php_codesniffer: dev-master
This package is not auto-updated.
Last update: 2024-12-21 20:08:46 UTC
README
Lift - PHP 7 micro framework
Introduction
Lift is an opinionated PHP 7 micro framework
Example
declare(strict_types=1); require('../vendor/autoload.php'); use Lift\Framework\App; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\JsonResponse; use Lift\Framework\Http\Response; function getHomepage(Request $request): JsonResponse { $response = Response\json(); $response->setData(['data' => ['stuff' => 'is awesome']]); return $response; } function getUserHandler (Request $request, array $args): JsonResponse { $response = Response\json(); $response->setData(['data' => ['userId' => $args['id'], 'username' => 'Jason Michels']]); return $response; } $app = new App(); $routes = [ ['httpMethod' => Request::METHOD_GET, 'route' => '/', 'handler' => 'getHomepage'], ['httpMethod' => Request::METHOD_GET, 'route' => '/user/{id:\d+}', 'handler' => 'getUserHandler'] ]; $app->run($routes);
Testing
$ phpunit
- Be Awesome!
Language
- PHP 7
License
GroundworkPHP is open-sourced software licensed under the MIT license
Authors
- Jason Michels