imponeer / env
Small helper dealing with environment variables
Installs: 13 067
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=8.3
- silinternational/php-env: ^3.3
Requires (Dev)
- fakerphp/faker: ^1.19
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12
- squizlabs/php_codesniffer: ^3.7
README
ENV
A lightweight and efficient PHP helper library for managing environment variables with a clean and simple API.
Installation
To install this package using Composer:
composer require imponeer/env
For manual installation, clone this repository and include the files from the src/
directory in your project.
Usage
Basic Usage
// Get an environment variable with a default value $path = env('APP_PATH', '/var/www'); // Get a boolean environment variable $isDebug = (bool) env('APP_DEBUG', false); // Get an integer value $port = (int) env('APP_PORT', 8080);
Development
Testing and Code Quality
This project uses several tools to ensure code quality and reliability. Here are the available commands:
Run Unit Tests Execute the test suite using PHPUnit:
composer test
Check Code Style Verify code adheres to PSR-12 standards:
composer phpcs
Fix Code Style Issues Automatically fix code style violations:
composer phpcbf
Run Static Analysis Perform static code analysis with PHPStan:
composer phpstan
Contributing
We welcome contributions! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes following PSR-12 coding standards
- Add tests for your changes
- Run the test suite:
composer test
- Check code style:
composer phpcs
- Fix any style issues:
composer phpcbf
- Run static analysis:
composer phpstan
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature-name
- Open a pull request
Reporting Issues
Found a bug or have a feature request? Please open an issue on our GitHub Issues page.
License
This project is licensed under the MIT License - see the LICENSE file for details.