PHP code example of sansanlabs / laravel-git-ftp-deployer
1. Go to this page and download the library: Download sansanlabs/laravel-git-ftp-deployer 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/ */
sansanlabs / laravel-git-ftp-deployer example snippets
return [
/*
|--------------------------------------------------------------------------
| Git-FTP Deploy Configuration
|--------------------------------------------------------------------------
|
| Configuration for Git-FTP deployment package
|
*/
"environments" => [
"staging" => [
"host" => env("STAGING_FTP_HOST"),
"username" => env("STAGING_FTP_USERNAME"),
"password" => env("STAGING_FTP_PASSWORD"),
"path" => env("STAGING_FTP_PATH", "/website/"),
],
"production" => [
"host" => env("PRODUCTION_FTP_HOST"),
"username" => env("PRODUCTION_FTP_USERNAME"),
"password" => env("PRODUCTION_FTP_PASSWORD"),
"path" => env("PRODUCTION_FTP_PATH", "/website/"),
],
],
/*
|--------------------------------------------------------------------------
| Build Command
|--------------------------------------------------------------------------
|
| The command to run before deployment
|
*/
"build_command" => env("GIT_FTP_BUILD_COMMAND", "npm run build"),
/*
|--------------------------------------------------------------------------
| Git Bash Path
|--------------------------------------------------------------------------
|
| Path to Git Bash executable (default on Windows)
|
*/
"git_bash_path" => env("GIT_BASH_PATH", "C:\\Program Files\\Git\\bin\\bash.exe"),
/*
|--------------------------------------------------------------------------
| Git-FTP Options
|--------------------------------------------------------------------------
|
| Additional options for git-ftp command
|
*/
"git_ftp_options" => [
"force" => env("GIT_FTP_FORCE", true),
"verbose" => env("GIT_FTP_VERBOSE", true),
"auto_init" => env("GIT_FTP_AUTO_INIT", true),
],
];
# Staging Environment
STAGING_FTP_HOST=ftp.yoursite.com
STAGING_FTP_USERNAME=your-username
STAGING_FTP_PASSWORD=your-password
STAGING_FTP_PATH=/public_html/staging/
# Production Environment
PROD_FTP_HOST=ftp.yoursite.com
PROD_FTP_USERNAME=your-username
PROD_FTP_PASSWORD=your-password
PROD_FTP_PATH=/public_html/
# Build Command (optional)
FTP_BUILD_COMMAND="npm run build"
# Git Bash Path
GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"
bash
php artisan vendor:publish --tag="git-ftp-deployer-config"
bash
php artisan deploy:ftp --env=staging
bash
php artisan deploy:ftp --env=production
bash
php artisan deploy:ftp
bash
php artisan deploy:ftp --skip-build