Inspired from PHP frameworks of all shape and sizes, Zapheus is a web application framework with a goal to be easy to use, educational, and fully extensible to the core. Whether a simple API project or a full enterprise application, Zapheus will try to adapt it according to developer's needs.
use Zapheus\Routing\Router;
use Zapheus\Application;
require 'vendor/autoload.php';
// Initializes the application
$app = new Application;
// Creates a HTTP route of GET /
$router = new Router;
$router->get('/', function ()
{
return 'Hello world!';
});
$app->set(Application::ROUTER, $router);
// Handles the server request
echo $app->run();Install the Zapheus package via Composer:
$ composer require zapheus/zapheusrequire 'vendor/autoload.php';
// Initializes the application
$app = new Zapheus\Application;
// Creates a HTTP route of GET /
$router = new Zapheus\Routing\Router;
$router->get('/', function ()
{
return 'Hello world!';
});
$app->set('Zapheus\Contract\Routing\Router', $router);
// Handles the server request
echo $app->run();$ php -S localhost:8000Open your web browser and go to http://localhost:8000.
Zapheus takes no dependencies from other frameworks or libraries. Each component is built with inspiration from the existing popular web frameworks to give developers the best development experience.
All of Zapheus' classes have their own easy to understand interfaces located in the Contract namespace. It enables developers to extend or optimize the core functionalities easily.
Even though Zapheus doesn't have dependencies from other libraries, it does have bridge packages to integrate your chosen libraries easily within the framework. These include the PHP Standards Recommendations (PSR) like PSR-07 and PSR-11.
// Converts a Zend Diactoros instance (a PSR-07 implementation)
// into a Zapheus HTTP request using the PSR-07 Bridge package
use Zapheus\Bridge\Psr\Zapheus\Request;
use Zend\Diactoros\ServerRequestFactory;
// Psr\Http\Message\ServerRequestInterface
$psr = ServerRequestFactory::fromGlobals();
// Zapheus\Http\Message\RequestInterface
$request = new Request($psr);Frameworks like Laravel and Symfony have their way of integrating packages into their own ecosystem. With that, Zapheus will try to get them both work in the same application in order for the developers to utilize framework-specific packages to their arsenal.
// Registers a third-party Laravel Service Provider
// into Zapheus using the Illuminate Bridge package
use Acme\Providers\AuthServiceProvider;
use Acme\Providers\RoleServiceProvider;
use Illuminate\Container\Container;
use Zapheus\Bridge\Illuminate\IlluminateProvider;
use Zapheus\Container\Container as ZapheusContainer;
// A collection of Laravel Service Providers
$providers = array(AuthServiceProvider::class, RoleServiceProvider::class);
// Include the providers in the bridge instance
$provider = new IlluminateProvider($providers);
// Registers the bindings into a container
$container = $provider->register(new ZapheusContainer);
// Returns the Illuminate\Container\Container
$laravel = $container->get(Container::class);As Zapheus is evolving as a micro-framework, there might be some breaking changes in its internal code during development. The said changes can be found in UPGRADING.
Please see CHANGELOG for more recent changes and latest updates.
See CONTRIBUTING on how to contribute to the project.
The MIT License (MIT). Please see LICENSE for more information.