1. Go to this page and download the library: Download onion/swoole library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
onion / swoole example snippets
### Configuration
return [
'application' => [
'server' => [
'address' => '', // The address on which to bind the app server. Binds on '0.0.0.0' if none is provided
'port' => 1234, // The port on which the server to listen. A random one will be used if none is provided
'options' => [ // A list of options that is being passed directly to `Swoole\Http\Server::set()` for configuration
]
]
]
];
return [
'factories' => [
// ... Definitions
// The base application is still in use, just make sure to register it directly as class name
\Onion\Framework\Application\Application::class => \Onion\Framework\Application\Factory\ApplicationFactory::class,
// The app server
\Swoole\Http\Server::class => \Onion\Extra\Swoole\Factory\HttpServerFactory::class,
// The definition of the application wrapper
\Onion\Framework\Application\Interfaces\ApplicationInterface::class => \Onion\Framework\Application\Factory\SwooleApplicationFactory::class,
// ... More definitions
],
];
// Bootstrap
/**
* Note the usage of the ApplicationInterface to fetch the application instance,
* this (or your equivalent) key should be changed to return the SwooleApplication
* instance
*/
$container->get(\Onion\Framework\Application\Interfaces\ApplicationInterface::class)
->run(); // Note the ServerRequest::fromGlobals() is not necessary here, so it can be omitted
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.