PHP code example of mozex / laravel-worktree

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

    

mozex / laravel-worktree example snippets


'herd' => env('WORKTREE_HERD', 'secure'),

'database' => [
    'connections' => [
        [
            'connection' => null,        // null is the app's default connection
            'env' => 'DB_DATABASE',      // the .env key holding this database's name
            'name' => '{slug}',          // the worktree database name
            'test' => [
                'env' => 'DB_DATABASE',  // the phpunit.xml <env> key to rewrite
                'name' => '{slug}_testing',
            ],
        ],
    ],
],

'phpunit_files' => ['phpunit.xml', 'phpunit.browser.xml'],

'database' => [
    'connections' => [
        [
            'connection' => null,
            'env' => 'DB_DATABASE',
            'name' => '{slug}',
            'test' => ['env' => 'DB_DATABASE', 'name' => '{slug}_testing'],
        ],
        [
            'connection' => 'analytics',           // the name from config/database.php
            'env' => 'ANALYTICS_DB_DATABASE',      // this connection's .env key
            'name' => '{slug}_analytics',
            'test' => ['env' => 'ANALYTICS_DB_DATABASE', 'name' => '{slug}_analytics_testing'],
        ],
    ],
],

'env' => [
    'copy' => ['.env.testing'],
],

'env' => [
    'replace' => [
        'REDIS_PREFIX' => '{value}{slug}_',
        'CACHE_PREFIX' => '{slug}_cache_',
    ],
],

'dependencies' => [
    'vendor'       => ['copy' => true, /* ... */],
    'node_modules' => ['copy' => true, /* ... */],
],

'steps' => [
    'npm run build --if-present',
    'php artisan storage:link',
],
bash
php artisan vendor:publish --tag=worktree-config
bash
php artisan worktree:setup feature/login
bash
php artisan worktree:setup
bash
php artisan worktree:teardown
bash
php artisan worktree:list
bash
php artisan worktree:path feature/login
# /Users/you/Sites/blog-feature-login