Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sync Content Bundle Laravel Package

brazilianfriendsofsymfony/sync-content-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation Clone the repository into your Symfony2 project’s vendor/bundles directory:

    git clone git://github.com/BrazilianFriendsOfSymfony/BFOSSyncContentBundle.git bundles/BFOS/SyncContentBundle
    

    Run php bin/vendors install to ensure dependencies are resolved.

  2. Enable the Bundle Add to app/AppKernel.php under dev/test environments:

    $bundles[] = new BFOS\SyncContentBundle\BFOSSyncContentBundle();
    
  3. Basic Configuration Add to app/config/config_dev.yml:

    bfos_sync_content:
        options:
            deployment:
                rsync_exclude:
                    - "%kernel.root_dir%/config/rsync_exclude.txt"
    
  4. First Sync Run the sync command:

    php app/console bfos:sync-content
    

Where to Look First

  • Command Reference: php app/console list bfos to see available commands.
  • Configuration: app/config/config_dev.yml for sync options.
  • Exclusion Rules: %kernel.root_dir%/config/rsync_exclude.txt to define files/folders to ignore.

Implementation Patterns

Workflows

  1. Local Development Sync Use bfos:sync-content to push local changes to a remote server during development:

    php app/console bfos:sync-content --env=dev
    
  2. Pre/Post-Sync Hooks Leverage pre_local_commands/post_local_commands for tasks like asset compilation:

    bfos_sync_content:
        options:
            deployment:
                pre_local_commands:
                    - 'php app/console assetic:dump --env=dev'
                post_local_commands:
                    - 'rm -rf web/cache/dev'
    
  3. Remote Server Commands Execute commands on the remote server post-sync (e.g., restarting services):

    bfos_sync_content:
        options:
            deployment:
                post_remote_commands:
                    - 'sudo service apache2 restart'
    

Integration Tips

  • Environment-Specific Configs Override config_dev.yml for test/prod environments (e.g., different remote paths or commands).
  • Custom Exclusions Use rsync_exclude to skip vendor/, logs/, or .git/:
    rsync_exclude:
        - "%kernel.root_dir%/../vendor"
        - "%kernel.root_dir%/../app/logs"
    
  • Dry Runs Test syncs without pushing:
    php app/console bfos:sync-content --dry-run
    

Gotchas and Tips

Pitfalls

  1. Environment Restrictions The bundle is only enabled in dev/test environments by default. Explicitly add it to prod if needed (not recommended for security).

  2. Rsync Dependencies Ensure rsync is installed on both local and remote machines. Test with:

    rsync --version
    
  3. Permission Issues Remote commands (e.g., post_remote_commands) require SSH access with proper permissions. Use keys or passwordless logins:

    ssh-copy-id user@remote-server
    
  4. Configuration Overrides Global options in config_dev.yml cannot be overridden per-command. Use environment-specific configs instead.

Debugging

  • Verbose Output Enable debug mode for detailed logs:
    php app/console bfos:sync-content -vvv
    
  • Check Remote Commands Test remote commands manually via SSH before adding them to the config.

Extension Points

  1. Custom Commands Extend the bundle by creating a custom command that inherits from BFOS\SyncContentBundle\Command\SyncContentCommand.

  2. Event Listeners Hook into sync events (e.g., pre/post-sync) by implementing BFOS\SyncContentBundle\Event\SyncContentEvents.

  3. Dynamic Exclusions Use Twig or PHP logic to generate rsync_exclude dynamically (e.g., exclude files matching a pattern):

    rsync_exclude:
        - "%kernel.root_dir%/../app/config/local/%env(APP_ENV)%/*.yml"
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle