Laravel Octane with Swoole
2 min read
Updated 14 hours ago
Laravel Octane with Swoole
Swoole is a high-performance PHP extension that provides asynchronous, parallel, and coroutine capabilities. When combined with Laravel Octane, it delivers exceptional performance for high-traffic applications.
What is Swoole?
Swoole is a PHP extension that offers:
- Asynchronous I/O operations
- Coroutine support for concurrent processing
- Built-in connection pooling
- Task workers for background processing
- Excellent performance under high load
Setting up Octane with Swoole
Follow these steps to deploy your Laravel application with Octane and Swoole:
- Navigate to your application's Settings tab
- Find the PHP runtime section
- Select FrankenPHP (Octane) as the runtime
- Save your settings
Enable the Swoole PHP extension
- Navigate to your application's Settings tab
- Find the PHP extensions section
- Enable the swoole extension
- Save your settings
Install Laravel Octane
Before deploying, install Laravel Octane in your application and commit the changes to your repository:
composer require laravel/octane
php artisan octane:install --server=swoole
Set the start command
Configure the start command in your application settings:
- Navigate to your application's Settings tab
- Find the Start command field
- Enter the following command:
php artisan octane:start --server=swoole --host=0.0.0.0 --port=8080
Deploy your application
After configuring the runtime, PHP extension, build commands, and start command, deploy your application. The deployment will:
- Build your application with the Swoole extension enabled
- Install Octane
- Start your application using the Swoole server