1. Go to this page and download the library: Download mbpcoder/grandpa 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/ */
task('deploy', function () {
$revision = storage()->ftp()->get('.revision'); // last deployed commit hash, or null on first deploy
storage()->ftp()->upload(git()->changedFiles($revision)); // upload added/modified files
storage()->ftp()->delete(git()->deletedFiles($revision)); // remove files deleted from git
storage()->ftp()->purge('public/build'); // wipe a remote directory
storage()->ftp()->uploadDir('public/build'); // push a whole local directory (e.g. built assets)
storage()->ftp()->put('.revision', git()->currentHead()); // record the deployed commit on the server
ssh()->run('cd /var/www/app && php artisan migrate --force && php artisan optimize');
say('Deployed');
});
task('deploy', function () {
$revision = storage()->ftp()->get('.revision');
storage()->ftp()->upload(git()->changedFiles($revision));
storage()->ftp()->delete(git()->deletedFiles($revision));
storage()->ftp()->put('.revision', git()->currentHead());
// Hit a route on the live site to clear cache / warm up / health-check.
$response = http()->get('https://example.com/__deploy/clear-cache');
say('Deployed and cache cleared: ' . $response);
});