A powerful tool for automating and streamlining Laravel application deployments to remote servers via FTP/SFTP.
- Automated directory and file uploads
- Configurable deployment paths
- Environment-specific settings
- Simple command-line interface
- PHP 7.4 or higher
- Composer
- Laravel 8.x or higher
- FTP/SFTP server access
Add Laravel Deployer to your project as a development dependency:
composer require codehubcare/laravel-deployer --dev
The --dev flag ensures it's only included in development environments.
Publish the configuration file to customize deployment settings:
php artisan vendor:publish --provider="Codehubcare\LaravelDeployer\LaravelDeployerServiceProvider"
This command creates a config/laravel-deployer.php file in your Laravel application where you can modify default settings.
Update your .env file with the following variables:
LARAVEL_DEPLOYER_SRC_PATH=src
LARAVEL_DEPLOYER_PUBLIC_PATH=public_html
# FTP/SFTP connection details
LARAVEL_DEPLOYER_FTP_HOST=your.ftp.host.com
LARAVEL_DEPLOYER_FTP_USERNAME=your_username
LARAVEL_DEPLOYER_FTP_PASSWORD=your_password
LARAVEL_DEPLOYER_FTP_PORT=21
Deploy your application with a single command:
php artisan laravel-deployer:deploy
What Happens During Deployment
- Connects to the remote server using provided credentials
- Uploads the source directory contents to the remote destination
- Creates necessary directories if they don't exist
- Maintains directory structure
- Connection Failed: Verify FTP credentials and network accessibility
- Permission Denied: Check remote directory permissions
- Files Not Visible: Confirm the correct remote path is set
- Always backup your application before deployment
- Test deployment in a staging environment first
- Keep sensitive credentials out of version control by using .env
For more advanced configuration options, refer to the config/laravel-deployer.php file comments.