- How do I install Laravel Installer globally for quick project creation?
- Run `composer global require laravel/installer` to install it globally. Afterward, use `laravel new project-name` in your terminal to scaffold a fresh Laravel project with the latest version and default configurations. Ensure Composer’s global bin directory is in your system PATH for direct CLI access.
- Does Laravel Installer support custom starter kits or templates?
- Yes, you can use the `--preset` flag to apply custom starter kits. For example, `laravel new project --preset=my-kit` will clone a predefined Git repository (configured in your Composer config) and apply it during installation. Ensure the kit follows Laravel’s project structure for compatibility.
- Can I use Laravel Installer in CI/CD pipelines like GitHub Actions?
- Absolutely. Use the `--no-interaction` flag to skip prompts and automate the process. For example, in GitHub Actions, add `composer require laravel/installer --dev && laravel new project --preset=ci` to your workflow. Avoid interactive flags like database selection unless handled via environment variables.
- What Laravel versions does the installer support, and how do I specify a version?
- The installer supports Laravel 10–13. To install a specific version, use the `--dev` flag with a version constraint, e.g., `laravel new project --dev 12.*`. By default, it installs the latest stable version. Check the [Laravel documentation](https://laravel.com/docs#installation) for version-specific requirements.
- Will Laravel Installer work on Windows, or is it Linux/macOS only?
- The installer is cross-platform and works on Windows, Linux, and macOS. However, some interactive prompts or path handling may behave differently on Windows. Test your workflows on the target OS, and use `--no-interaction` in CI/CD to avoid platform-specific quirks.
- How does Laravel Installer handle Node.js dependencies like Vite or Mix?
- The installer includes optional Node.js setup via flags like `--with-node-dependencies`. It will install npm, Yarn, or pnpm (depending on your config) and run `npm install` automatically. For custom setups, ensure your `.npmrc` or `package.json` scripts are compatible with Laravel’s defaults.
- Is Laravel Installer safe to use in production, or is it only for development?
- Laravel Installer is a **development tool** only—it’s not deployed to production. It’s designed to scaffold projects locally or in CI/CD environments. After installation, remove it from your `composer.json` (or mark it as `--dev`) to avoid unnecessary runtime overhead.
- Can I use Laravel Installer to update an existing Laravel project to a newer version?
- No, the installer is for **new projects only**. To update an existing project, use Composer directly: `composer update laravel/framework`. For major version upgrades, follow Laravel’s [upgrade guide](https://laravel.com/docs/upgrades) to avoid breaking changes.
- What are the alternatives to Laravel Installer, and when should I use them?
- Alternatives include `composer create-project laravel/laravel` (manual) or tools like `laravel-shift` for legacy migrations. Use the installer for **consistent, automated scaffolding** with presets. For **custom monorepos** or non-Laravel PHP projects, stick with Composer’s native commands or tools like `box` or `roave/security-advisories`.
- How do I troubleshoot issues like failed installations or corrupted .env files?
- Start by checking Composer’s debug logs (`composer --verbose new project`). If `.env` is corrupted, manually regenerate it with `cp .env.example .env`. For permission errors, ensure your user has write access to the target directory. If using custom presets, verify the Git repository’s `post-install` scripts aren’t conflicting with Laravel’s defaults.