Framework X – the simple and fast micro framework for building reactive web applications that run anywhere.
Once everything is installed, you can now use this example to get started with
a new app.php
file:
<?php
require __DIR__ . '/../vendor/autoload.php';
$app = new FrameworkX\App();
$app->get('/', function () {
return new React\Http\Message\Response(
200,
[],
"Hello wörld!\n"
);
});
$app->get('/users/{name}', function (Psr\Http\Message\ServerRequestInterface $request) {
return new React\Http\Message\Response(
200,
[],
"Hello " . $request->getAttribute('name') . "!\n"
);
});
$app->run();
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 PHP's built-in webserver for testing purposes like this:
$ php -S 0.0.0.0:8080 app.php
You can now use your favorite webbrowser or command line tool to check your web application responds as expected:
$ curl -v http://localhost:8080/
HTTP/1.1 200 OK
…
Hello wörld!
Hooked? See website for full documentation.
This project is currently under active development, you're looking at a temporary placeholder repository.
The code is available in early access to my sponsors here: https://github.com/clue-access/framework-x
Do you sponsor me on GitHub? Thank you for supporting sustainable open-source, you're awesome! ❤️ Have fun with the code! 🎉
Seeing a 404 (Not Found)? Sounds like you're not in the early access group. Consider becoming a sponsor on GitHub for early access. Check out clue·access for more details.
This way, more people get a chance to take a look at the code before the public release.
Rock on 🤘
This project will be 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.