- Can I use symplify/monorepo-builder with Laravel 9.x or older?
- No, the package requires PHP 8.2+ by default. For Laravel 9.x (PHP 8.1), use the legacy version `symplify/monorepo-builder:^11.2`, but note it’s no longer maintained. Laravel 10+ is fully supported with the latest release.
- How do I integrate monorepo-builder commands into Laravel’s Artisan CLI?
- Wrap the commands in custom Artisan commands. For example, create a `MonorepoServiceProvider` to register `monorepo:merge` as `php artisan monorepo:merge`. Use `Artisan::command()` to delegate to `vendor/bin/monorepo-builder merge`.
- Will this tool break my existing Laravel package autoloading?
- No, but you may need to configure `disableAutoloadMerge` in `monorepo-builder.php` for libraries to avoid duplicate `vendor/` entries. Test with `merge --dry-run` first to preview changes. Laravel’s `autoload-dev` remains unaffected.
- How does `validate` handle Laravel-specific dependencies like `laravel/framework` or `doctrine/dbal`?
- The `validate` command checks for version consistency across all packages. If `laravel/framework` is shared, it ensures all packages use the same version. Use `dataToRemove` in config to exclude non-critical packages from validation.
- Can I use this for a hybrid monorepo (PHP + Node.js)?
- No, this tool is PHP/Composer-focused. Hybrid repos require additional tooling (e.g., Lerna for Node.js). For pure PHP monorepos (e.g., Laravel + custom packages), it works seamlessly.
- How do I handle Laravel’s `extra.laravel` section during merge?
- Use `dataToAppend` in `monorepo-builder.php` to preserve or modify Laravel-specific sections. Example: `'dataToAppend' => ['extra.laravel' => ['preserve' => true]]`. Test with `--dry-run` to verify.
- What’s the best way to test monorepo-builder in CI before merging?
- Run `monorepo-builder validate` and `merge --dry-run` in CI pre-merge. For releases, use `release --dry-run` to simulate version bumps. GitHub Actions example: Add steps under `pull_request` to validate merged `composer.json`.
- How do I exclude certain packages from the monorepo workflow?
- Use `packageDirectoriesExcludes` in config to skip specific directories (e.g., `['tests/*', 'legacy/*']`). For `validate`, add packages to `dataToRemove`. Example: `'packageDirectoriesExcludes' => ['vendor/*']`.
- Does this tool support Laravel’s package discovery (e.g., `discover` in `composer.json`)?
- Yes, but ensure `discover` is included in `dataToAppend` if it’s critical. The tool merges all sections by default, including `autoload-dev` and `scripts`. Test with `--dry-run` to confirm discovery paths aren’t altered.
- What alternatives exist for Laravel monorepo management?
- For Laravel-specific needs, consider `spatie/laravel-package-tools` (for package development) or `nunomaduro/collision` (for dependency conflict detection). However, neither offers full monorepo automation like `symplify/monorepo-builder`. For PHP monorepos, this is the most comprehensive solution.