PHP code example of tombroucke / otomaties-deployer
1. Go to this page and download the library: Download tombroucke/otomaties-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/ */
tombroucke / otomaties-deployer example snippets
namespace Deployer;
:createImmutable(__DIR__);
$dotenv->load();
re 'vendor/tombroucke/otomaties-deployer/recipes/auth.php';
hp';
equire 'vendor/tombroucke/otomaties-deployer/recipes/woocommerce.php';
ge/build_command', 'build --clean --flush'); // build --clean for bud, build:production for webpack mix
set('sage/public_dir', 'public'); // public for bud, dist for webpack mix
/** Hosts */
host('production')
->set('hostname', 'ssh###.webhosting.be')
->set('url', '')
->set('remote_user', 'examplebe')
->set('branch', 'main')
->set('deploy_path', '/data/sites/web/examplebe/app/main');
host('staging')
->set('hostname', 'ssh###.webhosting.be')
->set('url', '')
->set('basic_auth_user', $_SERVER['BASIC_AUTH_USER'] ?? '')
->set('basic_auth_pass', $_SERVER['BASIC_AUTH_PASS'] ?? '')
->set('remote_user', 'examplebe')
->set('branch', 'staging')
->set('deploy_path', '/data/sites/web/examplebe/app/staging');
/** Notify deploy started */
before('deploy', 'slack:notify');
/** Install theme dependencies */
after('deploy:vendors', 'sage:vendors');
/** Push theme assets */
after('deploy:update_code', 'sage:compile_and_upload_assets');
/** Write revision to file */
after('deploy:update_code', 'otomaties:write_revision_to_file');
/** Reload Combell */
after('deploy:symlink', 'combell:reloadPHP');
/** Clear OPcode cache */
after('deploy:symlink', 'combell:reset_opcode_cache');
/** Cache ACF fields */
after('deploy:symlink', 'acorn:acf_cache');
/** Reload cache & preload */
after('deploy:symlink', 'wp_rocket:clear_cache');
/** Reload cache & preload */
after('deploy:symlink', 'wp_rocket:preload_cache');
/** Remove unused themes */
after('deploy:cleanup', 'cleanup:unused_themes');
/** Notify success */
after('deploy:success', 'slack:notify:success');
/** Unlock deploy */
after('deploy:failed', 'deploy:unlock');
/** Notify failure */
after('deploy:failed', 'slack:notify:failure');
/** Update WooCommerce tables */
after('deploy:symlink', 'woocommerce:update_database');
/** Update WooCommerce tables */
after('deploy:symlink', 'wordpress:clear_cache');