PHP code example of drlopes / template-sync

1. Go to this page and download the library: Download drlopes/template-sync 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/ */

    

drlopes / template-sync example snippets


// config/template-sync.php

return [

    /*
     * The name of the git remote pointing to the template repository.
     */
    'remote_name' => 'template',

    /*
     * The URL of the template repository.
     * Set this manually or run: php artisan template:connect
     */
    'url' => null,

    /*
     * The branch on the template repository to merge from.
     */
    'branch' => 'main',

    /*
     * Merge strategy. Currently only 'merge' is supported.
     */
    'merge_strategy' => 'merge',

    /*
     * Whether to pass --allow-unrelated-histories to git merge.
     * Enable this if git refuses to merge due to unrelated histories
     * (common when the repo was created from a GitHub template).
     */
    'allow_unrelated_histories' => false,

    /*
     * Backup branch settings. A backup branch is created before every
     * sync so you have a restore point if anything goes wrong.
     */
    'backup_branch' => [
        'enabled' => true,
        'prefix' => 'backup/before-template-update',
        'delete_on_success' => true,
    ],

    /*
     * Paths to keep at their local version even when the template changes them.
     * After merging, these files are restored to HEAD before committing.
     */
    'excluded_paths' => [
        // 'README.md',
        // '.env.example',
    ],

];
bash
php artisan vendor:publish --tag="template-sync-config"
bash
php artisan template:connect
bash
php artisan template:update
bash
# edit the conflicted files...
git add <resolved files>
php artisan template:update --continue
bash
php artisan template:update --abort