Framework X
Framework X – the simple and fast micro framework for building reactive web applications that run anywhere.
Support us
We invest a lot of time developing, maintaining and updating our awesome open-source projects. You can help us sustain this high-quality of our work by becoming a sponsor on GitHub. Sponsors get numerous benefits in return, see our sponsoring page for details.
Let's take these projects to the next level together!
Quickstart
Start by creating an empty project directory.
Next, we can start by taking a look at a simple example application.
You can use this example to get started by creating a new public/
directory with
an index.php
file inside:
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = new FrameworkX\App();
$app->get('/', function () {
return React\Http\Message\Response::plaintext(
"Hello wörld!\n"
);
});
$app->get('/users/{name}', function (Psr\Http\Message\ServerRequestInterface $request) {
return React\Http\Message\Response::plaintext(
"Hello " . $request->getAttribute('name') . "!\n"
);
});
$app->run();
Next, we need to install X and its dependencies to actually run this project. In your project directory, simply run the following command:
$ composer require clue/framework-x:dev-main
That's it already! The next step is now to serve this web application. One of the nice properties of this project is that is works both behind traditional web server setups as well as in a stand-alone environment.
For example, you can run the above example using the built-in web server like this:
$ php public/index.php
You can now use your favorite web browser or command line tool to check your web application responds as expected:
$ curl http://localhost:8080/
Hello wörld!
Documentation
Hooked? See website for full documentation.
Found a typo or want to contribute? The website documentation is built from the source documentation files in the docs/ folder.
Contribute
You want to contribute to the Framework X source code or documentation? You've come to the right place!
To contribute to the source code just locate the src/ folder and you'll find all content in there. Additionally, our tests/ folder contains all our unit tests and acceptance tests to assure our code works as expected. For more information on how to run the test suite check out our testing chapter.
If you want to contribute to the documentation of Framework X
found on the website, take a look inside the docs/ folder. You'll find further
instructions inside the README.md
in there.
Found a typo on our website? Simply go to our
website repository
and follow the instructions found in the README
.
Tests
To run the test suite, you first need to clone this repo and then install all dependencies through Composer:
$ composer install
To run the test suite, go to the project root and run:
$ vendor/bin/phpunit
The test suite is set up to always ensure 100% code coverage across all supported environments. If you have the Xdebug extension installed, you can also generate a code coverage report locally like this:
$ XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
Additionally, you can run some simple acceptance tests to verify the framework examples work as expected behind your web server. Use your web server of choice (see deployment documentation) and execute the tests with the URL to your installation like this:
$ php examples/index.php
$ tests/acceptance.sh http://localhost:8080
License
This project is released under the permissive MIT license.
Did you know that I offer custom development services and issuing invoices for sponsorships of releases and for contributions? Contact me (@clue) for details.