sheenazien8/konstantiq
| Install | |
|---|---|
composer require sheenazien8/konstantiq |
|
| Latest Version: | 1.0.0 |
| PHP: | ^8.1 |
| Laravel: | 10 · 11 |
| License: | MIT |
| Last Updated: | Apr 29, 2026 |
| Links: | GitHub · Packagist |
The missing constant class in laravel
This is a simple package that helps you manage your constant values. The root cause of this library is that sometimes you need the status in the view or the API response, but you have more than one status. You can look at the example below.
<?php
class SomeClass
{
// This method returns an array of status strings
public function pain(): array
{
return [
'Pending',
'Failed',
'Done'
];
}
// This method returns an array of status constants from PaymentStatus
public function healthy(): array
{
return PaymentStatus::all()->toArray();
}
}
Installation
You can install the package via composer:
composer require sheenazien8/konstantiq
You can publish the config file with:
php artisan vendor:publish --tag="konstantiq-config"
Usage
php artisan make:constant PaymentStatus #it will generate class \App\Constants\PaymentStatus
<?php
namespace App\Constants;
use Sheenazien8\Konstantiq\ConstanstAbstraction;
class PaymentStatus extends ConstanstAbstraction
{
// You can add the constants that you need
const PENDING = 'pending';
const DONE = 'done';
}
// Usage example
PaymentStatus::PENDING; // will return the 'pending' value
PaymentStatus::all(); // will return the all of the constants
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.0 | ^8.1 | ^10.0| | MIT |