- How do I install the Laravel installer globally via Composer?
- Run `composer global require laravel/installer` to install it globally. Ensure your Composer global bin directory is in your system PATH. Verify with `laravel --version` to confirm installation.
- Can I create a Laravel project without interactive prompts in CI/CD?
- Yes, use the `--no-interaction` flag (e.g., `laravel new my-project --no-interaction`). This skips prompts for app name, database, and other configurations, making it ideal for automated pipelines.
- What Laravel versions does the installer support?
- The installer supports Laravel 11.x, 12.x, and 13.x by default. Use `--version` to specify a specific release (e.g., `laravel new project --version=12.*`). Older versions may require manual overrides.
- How do I customize the default Laravel scaffolding (e.g., add custom migrations or frontend templates)?
- Use the `--preset` flag to point to a custom starter kit (Git repo or local path). For example, `laravel new project --preset=https://github.com/team/custom-starter`. You can also fork the installer and modify its templates.
- Does the installer work on Windows, or is it Linux/macOS-only?
- The installer is cross-platform and officially supports Windows, Linux, and macOS. However, some interactive prompts may behave differently on Windows; test with `--no-interaction` in CI for reliability.
- Can I pre-configure the `.env` file or database settings during installation?
- Yes, use the `--env` flag to pass custom `.env` values (e.g., `laravel new project --env=APP_DEBUG=false`). For databases, specify `--database=mysql` or `--database=postgres` and provide credentials via prompts or `--env` overrides.
- What’s the difference between `laravel new` and `composer create-project`?
- `laravel new` is optimized for Laravel-specific workflows, including frontend scaffolding (Vite, Inertia, etc.), while `composer create-project` is generic. The installer also supports custom presets and better handles Laravel-specific configurations like `.env` defaults.
- How do I integrate the installer into GitHub Actions or GitLab CI?
- Add a step like `- name: Install Laravel
run: laravel new . --preset=./templates/base --no-interaction`. Cache Composer dependencies (`composer cache dir`) and Node modules (`node_modules`) to speed up builds. Avoid interactive flags in CI.
- Are there security risks when using the Laravel installer?
- The installer is MIT-licensed and open-source with no malicious code execution risks. However, always verify custom presets or starter kits from trusted sources. Use `--no-interaction` in CI to avoid unintended configurations.
- What if I need to support legacy Laravel versions (e.g., 10.x or older)?
- The installer defaults to Laravel 11+. For older versions, manually specify `--version=10.*` or use `composer create-project` as a fallback. Note that some features (e.g., Vite scaffolding) may not work on older Laravel releases.