strictlyphp / dolphpin
2.0.2
2025-05-06 11:24 UTC
Requires
- php: >=8.2
- ext-bcmath: *
- ext-curl: *
- ext-intl: *
- ext-mbstring: *
- ext-simplexml: *
- fig/http-message-util: ^1.1
- psr/http-server-handler: ^1.0
- slim/psr7: ^1.7
Requires (Dev)
- league/route: ^6.2
- php-coveralls/php-coveralls: ^2.7
- phpstan/phpstan: ^1.8
- phpstan/phpstan-phpunit: ^1.1
- phpunit/phpunit: ^9.5
- symplify/easy-coding-standard: ^11.1
This package is auto-updated.
Last update: 2025-05-06 11:29:43 UTC
README
Dolphin is a lightweight PHP framework designed for running DigitalOcean functions. It has two versions:
- v1: For PHP 8
- v2: For PHP 8.2
Installation
Install Dolphin via Composer:
composer require strictlyphp/dolphin:^1.0 # For PHP 8 composer require strictlyphp/dolphin:^2.0 # For PHP 8.2
Usage
Controller Example
A controller handles the logic of the request. Example:
<?php namespace Service\User\Controllers; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use StrictlyPHP\Dolphin\Response\JsonResponse; class CreateUserController { public function __invoke(ServerRequestInterface $request): ResponseInterface { return new JsonResponse(['foo' => 'bar']); } }
Main Index File
In your main application file, you will include and run the app using the routes.php
:
<?php use Service\User\Controllers\CreateUserController; use League\Route\Router; function main(array $event, object $context): array { $router = new Router; $router->post('/users', CreateUserController::class); $app = new \StrictlyPHP\Dolphin\App($router); return $app->run($event, $context); }
License
This project is licensed under the MIT License.
This markdown version includes installation instructions, usage details (routes and controllers), and the main application setup. It is a comprehensive README for the Dolphin framework.