PHP code example of vitnasinec / laravel-envoy-config

1. Go to this page and download the library: Download vitnasinec/laravel-envoy-config 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/ */

    

vitnasinec / laravel-envoy-config example snippets


$envoy = new Config(
    remote: new Environment(
        ssh: '[email protected]',
        path: '~/code/www',
        storagePull: [new Storage('storage/app')],
        ...
    ),
    local: new Environment(path: '/Users/me/Sites/example', db: ...),
);

$envoy = new Config(
    remote: new Environment(
        ssh: '[email protected]',   // or the bare host, if ~/.ssh/config knows the user
        port: null,                              // a number only to override ~/.ssh/config's port
        path: '~/code/www',                      // project root on the server
        php: 'php',                              // absolute paths for hosts that lack them on PATH,
        composer: 'composer',                    //   e.g. '/opt/alt/php83/usr/bin/php'
        npm: 'npm',                              //   or  'php ~/code/bin/composer'
        build: true,                             // build assets there on deploy / code-push
        deployFrom: 'main',                      // any other branch is asked about first
        storagePull: [new Storage('storage/app')],   // comes down from this remote
        storagePush: [],                             // goes up to it
        db: new Database(
            database: 'example_db',
            host: '127.0.0.1',
            port: 3306,
            username: Env::get('PROD_DB_USERNAME'),  // .env
            password: Env::get('PROD_DB_PASSWORD'),  // .env
            dumps: './storage/envoy',                // where dumps are written there; the default
        ),
    ),
    local: new Environment(
        path: '/Users/me/Sites/example',          // this project's root, here
        db: new Database(
            database: 'example_db',
            username: Env::get('DB_USERNAME'),
            password: Env::get('DB_PASSWORD'),
        ),
    ),
);

db: new Database('~/code/www/database/database.sqlite'),

remote: [
    'prod' => new Environment(
        ssh: '[email protected]',
        path: '~/code/prod',
        build: true,
        deployFrom: 'main',
        storagePull: [new Storage('storage/app')],
        db: new Database(
            database: 'example_prod',
            username: Env::get('PROD_DB_USERNAME'),
            password: Env::get('PROD_DB_PASSWORD'),
            readOnly: true,
        ),
    ),
    'dev' => new Environment(
        ssh: '[email protected]',
        path: '~/code/dev',
        storagePush: [new Storage('storage/app')],
        db: new Database(
            database: 'example_dev',
            username: Env::get('DEV_DB_USERNAME'),
            password: Env::get('DEV_DB_PASSWORD'),
        ),
    ),
],

db: new Database(
    database: 'example_db',
    username: Env::get('PROD_DB_USERNAME'),
    password: Env::get('PROD_DB_PASSWORD'),
    readOnly: true,
),

$envoy = new Config(
    remote: new Environment(
        ssh: '[email protected]',
        path: '~/code/www',
        storagePull: [new Storage('storage/app')],
    ),
    local: new Environment(path: '/Users/me/Sites/example'),
);

'prod' => new Environment(ssh: ..., path: ..., deployFrom: 'main'),
'dev' => new Environment(ssh: ..., path: ...),   // any branch

'prod' => new Environment(
    // ...
    storagePull: [
        new Storage('storage/media'),
    ],
),

'dev' => new Environment(
    // ...
    storagePush: [
        new Storage('storage/app', delete: true),
    ],
),
sh
composer vitnasinec/laravel-envoy-config/stubs/Envoy.blade.php Envoy.blade.php