orb / orb
A quick and easy framework to rapidly create API or simple website.
Requires
- php: ^8.2
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-pdo: *
- ext-simplexml: *
- borschphp/router: ^3.0
- laminas/laminas-diactoros: ^3.5
- league/container: ^4.2
- monolog/monolog: ^3.9
Requires (Dev)
- pestphp/pest: ^3.0
- phpstan/phpstan: ^2.1
This package is auto-updated.
Last update: 2025-06-12 10:36:30 UTC
README
Orb
A simple and fast framework to build REST APIs and simple web applications.
Table of Contents
About The Project
Quickly and easily create REST APIs and simple web applications with Orb.
Versatile enough to build any kind of application, and simple enough to be used by beginners.
Getting Started
Prerequisites
You need PHP >= 8.2
to use Orb but the latest stable version of PHP is always recommended.
Installation
Via composer :
composer require orb/orb
Usage
require_once __DIR__.'/vendor/autoload.php'; use Orb\Orb; $orb = new Orb(); $orb->get('/', 'Hello world !'); $orb->get('/using-function', fn() => 'Hello world !'); $orb->get('/using-invoke', MyController::class); $orb->get('/using-class-method-1', 'MyController::method1'); $orb->get('/using-class-method-2', 'MyController->method2'); $orb->get('/psr7-response', fn() => new \Laminas\Diactoros\Response\HtmlResponse('Hello world !')); $orb->run();
It is possible to return mostly anything from a route handler.
If you do not return a PSR-7 ResponseInterface
, Orb will try to convert the returned value to a ResponseInterface
.
Note that Orb will return a JSON response if the returned value is an array or an object, and an XML response if the
returned value is a SimpleXMLElement
or DOMDocument
.
The default response is a text/html
response.
Testing
This package uses Pest
as test framework.
To run tests :
./vendor/bin/pest tests
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See License File for more information.