takemo101 / chubby
A package to easily use the slim framework
v0.1.8
2024-08-22 06:09 UTC
Requires
- php: ^8.2
- fig/http-message-util: ^1.1
- illuminate/collections: ^10.28
- monolog/monolog: ^3.4
- nyholm/psr7: ^1.8
- nyholm/psr7-server: ^1.1
- php-di/invoker: ^2.3
- php-di/php-di: ^7.0
- psr/clock: ^1.0
- psr/event-dispatcher: ^1.0
- slim/slim: 4.*
- symfony/console: ^6.4|^7.0
- symfony/error-handler: ^6.4|^7.0
- symfony/event-dispatcher-contracts: ^3.5
- symfony/filesystem: ^6.4|^7.0
- symfony/mime: ^6.4|^7.0
- symfony/process: ^6.4|^7.0
- symfony/uid: ^6.4|^7.0
- vlucas/phpdotenv: ^5.5
Requires (Dev)
- laravel/pint: ^1.13
- mockery/mockery: ^1.6
- pestphp/pest: ^2.20
- phpstan/phpstan: ^1.10
- symfony/var-dumper: ^6.4|^7.0
This package is auto-updated.
Last update: 2024-10-22 06:33:10 UTC
README
A package to easily use the slim framework.
Installation
composer require takemo101/chubby
Usage
php -S localhost:8080 index.php
<?php // index.php use Psr\Http\Message\ResponseInterface; use Takemo101\Chubby\Http; require_once __DIR__ . '/vendor/autoload.php'; $http = Http::createSimple(); $http->get( '/books/{id}', function (ResponseInterface $response, string $id) { $response->getBody()->write("ID = {$id}"); return $response; }, ); $http->run();
php console hello
#!/usr/bin/env php <?php // console use Symfony\Component\Console\Output\OutputInterface; use Takemo101\Chubby\Console\Command\ClosureCommand; use Takemo101\Chubby\Console; require_once __DIR__ . '/vendor/autoload.php'; $console = Console::createSimple(); $console->addCommand( ClosureCommand::from( function (OutputInterface $output) { $output->writeln('Hello World!'); return ClosureCommand::SUCCESS; }, )->setName('hello'), ); $console->run();