https://github.com/frdl/environment
Simple PHP environment manager.
https://github.com/frdl/environment
Last synced: 5 months ago
JSON representation
Simple PHP environment manager.
- Host: GitHub
- URL: https://github.com/frdl/environment
- Owner: frdl
- Created: 2020-05-19T06:12:18.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-12T04:02:21.000Z (almost 6 years ago)
- Last Synced: 2025-05-06T20:56:04.094Z (about 1 year ago)
- Language: PHP
- Size: 41 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Environment
This is a environment library for quick environment setup. [Forked from ahirarge/environment](https://github.com/ahirarge/environment)
## Installation
To install through composer, simply put the following in your `composer.json` file:
```json
{
"require": {
"frdl/environment": "*",
}
}
```
## Usage
`index.php`
```php
$environment = new Frdlweb\Environment\Environment;
$environment->path('/')
->detectEnvironment([
'local' =>[
'required' => true,
'hosts' => ['your-machine-name']
]
]);
```
`index.php`
```php
$environment = new Frdlweb\Environment\Environment;
$environment->dir('/home/')
->detectEnvironment([
'local' =>[
'required' => false,
'hosts' => ['your-machine-name']
]
]);
```
> You can check your machine name with `hostname` command.
`.env.local.php`
```php
return [
'secret-password' => 'secret-password-value'
];
```
`.env.local.json`
```json
{
"environment": "development"
}
```
```php
$secret = getenv('secret-password');
```
## Facades
If you wish, you can use environment library with facade connector. Please visit for guideline. [ahir/facades](https://github.com/ahirarge/facades)
## License
MIT