- What is leovie/php-param-generator used for in Laravel?
- It is a lightweight, framework-agnostic PHP utility for building and normalizing parameter sets from arrays, objects, or form input. It applies casting, defaults, and filtering so you can produce clean arrays or query strings for HTTP requests, route generation, jobs, or service layers. In Laravel it can be called from controllers, jobs, commands, or test helpers without a service provider or config file. For build-time code generation, keep it as a dev dependency.
- How do I install leovie/php-param-generator with Composer?
- Install it with composer require leovie/php-param-generator, or composer require --dev leovie/php-param-generator if you only use it for code generation or test fixtures. There is no Laravel service provider, facade, or config publish step. Composer autoloading is all the wiring you need.
- Does leovie/php-param-generator support Laravel 10, 11, or 12?
- The package is framework-agnostic and has no Laravel-specific service provider or version constraints, so Laravel support depends on your PHP version and Composer constraints rather than a Laravel major version. Check the package's composer.json for its declared PHP requirement and validate it against your application matrix. If it installs and your PHP version is supported, it can be used from Laravel controllers, jobs, commands, or tests.
- Do I need to configure leovie/php-param-generator for Laravel?
- No. It has no configuration file, service provider, facade, or publishable assets. You use its API directly in PHP code and optionally wrap it in a small internal helper if you want project-specific defaults or conventions. That keeps integration to a Composer entry rather than framework wiring.
- What are common use cases for a PHP parameter generator?
- Typical uses include normalizing request or query parameters, composing route parameters, building service-layer argument arrays, and producing query strings from one source. It is also useful for keeping generated parameter definitions, DTO-like classes, or test fixtures consistent when the same shape is maintained by hand in multiple places. The value is highest when the same parameter shape is repeated and you want predictable casting, defaults, and filtering.
- How do I get a query string from leovie/php-param-generator?
- Build the parameter set through the fluent builder, apply casting, defaults, and filtering, then use the package's query-string output from the same source that produces the array. That lets you reuse one normalized parameter definition for both HTTP request URLs and internal arrays. Exact method names should be checked in the README or API docs for your installed version.
- Can leovie/php-param-generator cast values and apply defaults automatically?
- Yes. The package is designed to apply type casting and defaults consistently when the parameter set is built. You define the expected types and default values, then build once to get normalized output instead of repeating casts and null checks across controllers or services. This helps keep request, method, and service parameters consistent.
- How does filtering work for null, blank, or unwanted keys?
- The builder supports filtering nulls, blanks, and unwanted keys so the final array or query string contains only the parameters you intend to send. This is useful for optional request parameters, sparse forms, and route generation where empty values should be omitted rather than serialized. You should confirm exact filter semantics in the README for your pinned version.
- Is leovie/php-param-generator safe to use in production?
- It is a small, dependency-free PHP utility, so runtime risk is limited, but you should still pin the version and test the parameter shapes your application depends on. The project has a single maintainer and older release history, so treat it as a contained tooling dependency rather than a critical framework component. For code generation, commit generated output and review diffs in CI so silent output changes are visible. If used only in dev tooling, it never ships to production.
- What are alternatives to leovie/php-param-generator, and is it still maintained?
- Alternatives include hand-written DTOs or parameter objects, Laravel's request validation and data transfer objects, Symfony OptionsResolver, and custom normalization helpers. The package is framework-agnostic and lightweight, but maintenance signals matter: it has a single maintainer, no dependents, and a 2022 release, so check the repository before adopting it broadly. Pin the version, keep the integration thin, and record the exit cost if you need to replace it.