- How do I install phfoxer/apigenerate in a Laravel application?
- Install it with Composer using composer require phfoxer/apigenerate, ideally as a require-dev entry since it is a development-time scaffolding tool rather than a runtime library. The package is presumed to support Laravel package auto-discovery, so no manual service provider registration should be needed. Check the repository README for the exact Artisan command name and any config or stub publishing step before running it. Test it first in a spike branch so you can review the generated diff before committing anything.
- Which Laravel and PHP versions does phfoxer/apigenerate support?
- The package was released on 2023-03-03, so it most likely targets the Laravel 9 or 10 era and corresponding PHP 8.x versions. There is no visible maintained compatibility matrix, CI matrix, or explicit validation against PHP 8.3 and newer, so you should read the version constraints in its composer.json yourself. Pin an exact version rather than using a floating constraint, and verify it installs cleanly on both your current and next-upgrade Laravel target. Do not assume an upstream fix will arrive for a future Laravel major.
- What does phfoxer/apigenerate actually generate for a Laravel API?
- It is an Artisan-driven generator that produces Laravel artifacts such as controllers, models, form requests or API resources, and route entries, derived from your application's models or schema. The goal is to remove the repetitive controller and route wiring that normally accompanies each new REST resource. The exact file set and conventions emitted are not documented in the package metadata, so run it against a sample table and inspect the output before adopting it. Generated files become your code and remain in your repository permanently.
- Does phfoxer/apigenerate overwrite existing controllers and routes when re-run?
- This is not verifiable from the package metadata and should be confirmed before you rely on it. Run the generator twice on a scratch resource and observe whether it silently overwrites, prompts for confirmation, or refuses on conflict. If it is non-idempotent, treat it as a once-per-resource tool and keep generation in a dedicated branch where diffs are easy to review. Safe re-running after schema changes matters a lot if you expect to regenerate as your models evolve.
- Can I customize the stubs used by phfoxer/apigenerate to match house conventions?
- Publishable, editable stubs are the usual pattern for Laravel generators, but the README excerpt does not confirm whether this package exposes them. Check for a vendor:publish tag covering stubs or config, and inspect the package directory for a stubs folder. Custom stubs are important because otherwise you accept the maintainer's conventions for validation, resource shaping, and route naming. If stubs are not publishable, plan to fork the package so you can enforce your own style.
- Does the generated code include validation, authorization, pagination, and tests?
- The package metadata does not document whether the output includes form request validation, policy or gate hooks, pagination, or generated tests. That gap is worth resolving early, because boilerplate that passes review while encoding permissive fillable arrays or N+1 queries is a real failure mode. Generate one resource, then read the controller and request classes line by line before letting the pattern spread. If key pieces are missing, either patch the stubs or add them manually as part of your review checklist.
- Is phfoxer/apigenerate safe to use in a production Laravel application?
- Because it is a dev-time generator, the package itself does not enter your request lifecycle and can be removed after generation with no runtime footprint. The real production risk is the generated code, which is committed and maintained by your team going forward. Treat it as a require-dev dependency, review every generated file as if a junior developer wrote it, and never run it unattended against a live codebase. Supply-chain exposure is modest but non-zero, since it executes in developer environments and CI.
- How does phfoxer/apigenerate compare to Laravel's built-in make:model -mcr and make:controller commands?
- It competes directly with first-party Artisan scaffolding that already ships with Laravel and requires no extra dependency. The bar it must clear is being meaningfully better than native make:* commands, for example by generating a fuller REST resource stack in one pass. Given its low adoption (around 40 stars and no dependents), evaluate it on measured time saved per resource rather than on the pitch. Many teams will find native generators plus a small internal stub sufficient.
- Is phfoxer/apigenerate still maintained, and what happens if it breaks on a newer Laravel version?
- Adoption signals are weak: roughly 40 stars, zero dependents, a single maintainer, no visible security policy, and no release in about two years. That bus factor of one means you should not plan on upstream fixing a Laravel 12 incompatibility. If you adopt it, plan for a private or vendored fork from day one and assume you own the maintenance. Alternatively, generate once, commit the output, and drop the dependency entirely.
- Does phfoxer/apigenerate work for contract-first or OpenAPI-driven APIs?
- No, it derives output from your application's models or database schema, which makes it a poor fit when an OpenAPI or JSON Schema contract is the source of truth. It also fits poorly in polyglot stacks or event-sourced and CQRS architectures where generation must follow an interface definition rather than Eloquent tables. It is best suited to Laravel monoliths and modular monoliths doing conventional CRUD over Eloquent. For contract-first programs, use a generator driven by the specification instead.