utopia-php / platform
Light and Fast Platform Library
Installs: 34 260
Dependents: 2
Suggesters: 0
Security: 0
Stars: 10
Watchers: 6
Forks: 4
Open Issues: 3
Requires
- php: >=8.0
- ext-json: *
- ext-redis: *
- utopia-php/cli: 0.19.*
- utopia-php/framework: 1.0.*
- utopia-php/queue: 0.8.*
- utopia-php/servers: 0.1.*
Requires (Dev)
- laravel/pint: 1.2.*
- phpunit/phpunit: ^9.3
- dev-main
- 0.8.1
- 0.8.0
- 0.7.x-dev
- 0.7.1
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.x-dev
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.0
- dev-feat-param-skip-validation
- dev-feat-upgrade-http
- dev-framework-0.34.x
- dev-integrate-workers
- dev-feat-custom-queue-names
- dev-feat-upgrade-framework-lib
- dev-integrate-workers-dl
- dev-feat-upgrade-framework
- dev-fix-func-g4
This package is auto-updated.
Last update: 2024-10-22 10:30:23 UTC
README
An object oriented way of writing Applications using Utopia libraries
Getting Started
This library contains abstract classes that assist in implementing services and actions for Utopia http framework and CLI. You must implement Platform
, Service
and Action
classes to build your application.
Example
Install using composer
composer require utopia-php/platform
Implementing a HTTP services using platform.
// Action <?php use Utopia\Platform\Action; class HelloWorldAction extends Action { public function __construct() { $this->httpPath = '/hello'; $this->httpMethod = 'GET'; $this->inject('response'); $this->callback(fn ($response) => $this->action($response)); } public function action($response) { $response->send('Hello World!'); } } // service use Utopia\Platform\Service; class HelloWorldService extends Service { public function __construct() { $this->type = Service::TYPE_HTTP; $this->addAction('hello', new HelloWorldAction()); } } // Platform use Utopia\Platform\Platform; class HelloWorldPlatform extends Platform { public function __construct() { $this->addService('helloService', new HelloWorldService()); } } // Using platform to initialize http service $platform = new HelloWorldPlatform(); $platform->init('http');
System Requirements
Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.
Contributing
All code contributions - including those of people having commit access - must go through a pull request and be approved by a core developer before being merged. This is to ensure a proper review of all the code.
We truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the contribution guide.
Copyright and license
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php