Install via Composer:
composer require hiqdev/hidev-license
Ensure you have HiDev installed as this is a plugin for it.
Configure HiDev:
Add the plugin to your hidev.json under the plugins section:
{
"plugins": {
"hiqdev/license": {}
}
}
First Use Case: Generate a license file for your project by running:
hidev license:generate
This will prompt you to select a license type (MIT, BSD, proprietary, etc.) and generate the corresponding LICENSE file.
License Generation:
license:generate command to create a LICENSE file with predefined templates (MIT, BSD, Apache, etc.).--name="Your Name" or --year=2023).Integration with HiDev:
hidev.json:
{
"goals": {
"init": ["license:generate"]
}
}
This ensures a license is generated whenever the init goal is run.Custom Templates:
templates directory of your project.config/license-templates/ (if using HiDev’s config system).CI/CD Pipeline:
license:generate command into your CI pipeline (e.g., GitHub Actions) to ensure every new repository starts with a valid license.- name: Generate License
run: vendor/bin/hidev license:generate --name="Your Company" --year=2023
HiDev Dependency:
hidev --version
Template Overrides:
MIT.txt). Mismatched structures may cause generation failures.hidev license:generate --debug output.Outdated Package:
Configuration Quirks:
hidev-config, ensure the plugin is registered in the correct section (e.g., plugins or extensions). Older versions may require extension-config.Verbose Output:
Use --debug or -v flags to diagnose issues:
hidev license:generate --debug
Check HiDev Logs:
HiDev logs are stored in ~/.cache/hidev/logs/ (Linux/macOS) or %APPDATA%\hidev\logs (Windows). Inspect these for errors during generation.
Template Validation: Validate custom templates by manually running:
hidev license:generate --template="custom-license.txt"
Custom License Types: Add new license templates by:
.txt files in config/license-templates/ (or a custom path).hidev.json to reference the new template:
{
"license": {
"templates": ["config/license-templates/custom-license.txt"]
}
}
Dynamic Data Injection:
Extend the license generation logic by overriding the LicenseGenerator class (if using HiDev’s plugin system). Example:
// In a custom plugin
public function generateLicense() {
$licenseText = $this->renderTemplate('MIT.txt', [
'year' => date('Y'),
'name' => 'Custom Company',
]);
file_put_contents('LICENSE', $licenseText);
}
Post-Generation Hooks: Use HiDev’s event system to run scripts after license generation (e.g., commit the file automatically):
{
"hooks": {
"license:generate:after": ["git add LICENSE", "git commit -m 'Add LICENSE'"]
}
}
How can I help you explore Laravel packages today?