- Can I install Statamic CMS into an existing Laravel 10+ project without breaking my current setup?
- Yes, Statamic is designed as a Composer package for Laravel 10+ and integrates cleanly with existing projects. It uses Laravel’s routing, middleware, and service container, so conflicts are rare. However, ensure your PHP version is 8.1+ and audit for potential route or asset pipeline conflicts (e.g., Vite/Webpack). Start with `composer require statamic/cms` and follow the [installation docs](https://statamic.dev/installation).
- How does Statamic’s flat-file storage (YAML/JSON) compare to Eloquent for performance in high-traffic sites?
- Flat files are slower than databases for high-traffic sites (e.g., 10K+ entries) due to disk I/O. Mitigate this with aggressive caching (e.g., `statamic:static` or Redis) or hybrid approaches like caching frequently accessed content in a database. Benchmark with `statamic:optimize` and consider Statamic’s API for dynamic content. For real-time queries, evaluate whether flat files meet your needs or if a hybrid solution is better.
- I’m using Laravel Sanctum for authentication. Can Statamic’s user system coexist with it?
- Statamic includes its own user system but can coexist with Laravel Sanctum if configured properly. Use middleware to route specific paths (e.g., `/cp` for Statamic admin) to Statamic’s auth while letting Sanctum handle other routes. Check the [authentication docs](https://statamic.dev/authentication) for customization options. Test thoroughly with `php artisan route:list` to avoid conflicts.
- What’s the best way to migrate existing Eloquent models to Statamic’s flat-file collections?
- Use Statamic’s [Migrator tool](https://github.com/statamic/migrator) to export Eloquent data to YAML/JSON collections. For complex models, write custom scripts to transform queries (e.g., `Model::where()` → `Statamic::collections()->where()`). Start with a pilot migration (e.g., a blog) and validate data integrity. Document the process for your team to avoid future confusion.
- Does Statamic support static site generation (SSG) for faster load times, and how does it work?
- Yes, Statamic supports SSG via the `statamic:static` command, which generates static HTML files from your content. Configure it in `statamic.php` under the `static` key and run `php artisan statamic:static` to build assets. Deploy the static files to a CDN or storage bucket for near-instant load times. Ideal for marketing sites or blogs where content changes infrequently.
- Can I use Statamic’s GraphQL API to power a decoupled frontend (e.g., React, Vue) without Laravel’s Blade?
- Absolutely. Statamic includes built-in GraphQL support for querying collections, assets, and users. Enable it in `config/statamic.php` under `graphql` and define your schema in `graphql/schema.graphql`. Use tools like Apollo Client or Relay to connect your frontend. This is perfect for headless setups where content is managed in Statamic but displayed via a separate frontend.
- Are there any security risks with storing content in Git (e.g., API keys, sensitive data)?
- Yes, sensitive data in YAML/JSON files can leak if committed to Git. Use environment variables for secrets (e.g., `.env`) and add them to `.gitignore`. For API keys or passwords, avoid hardcoding them in blueprints or fieldtypes. Audit your repository regularly with `git check-ignore` and consider using Statamic’s [environment variables](https://statamic.dev/environment) for dynamic values.
- How do I customize Statamic’s fieldtypes or blueprints for my specific content needs?
- Extend Statamic with custom fieldtypes (PHP/JS) or blueprints (YAML) to tailor content structures. Start with the [fieldtype docs](https://statamic.dev/fieldtypes) and use existing add-ons like `statamic/vue-fieldtypes` for Vue-based solutions. For complex logic, create a custom fieldtype class in `app/Fieldtypes` and register it in a service provider. Test thoroughly with edge cases.
- What Laravel versions does Statamic CMS support, and how do I check compatibility?
- Statamic CMS officially supports Laravel 10.x. Check your project’s compatibility by running `composer require statamic/cms` and verifying the `composer.json` constraints. For older Laravel versions (e.g., 9.x), use the `statamic/statamic` package instead, but note that features may lag behind. Always test in a staging environment before deploying to production.
- Are there alternatives to Statamic for Laravel that offer similar flat-file or Git-based CMS features?
- Yes, alternatives include **October CMS** (Laravel-based, file/database hybrid), **Kirby** (PHP-based, flat-file), and **Directus** (headless CMS with database/flat-file options). However, Statamic stands out for its deep Laravel integration, Git-native workflow, and modular design. Evaluate based on your needs: Statamic excels for Laravel devs prioritizing simplicity and extensibility, while October or Directus may suit teams needing more traditional CMS features.