PHP Classes

File: readme.md

Recommend this page to a friend!
  Classes of Till Wehowski   PHP Environment Variables Detection   readme.md   Download  
File: readme.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Environment Variables Detection
Detect the current PHP environment variables
Author: By
Last change:
Date: 6 months ago
Size: 1,385 bytes
 

Contents

Class file image Download

Environment

This is a environment library for quick environment setup. Forked from ahirarge/environment

Installation

To install through composer, simply put the following in your composer.json file:

{
    "require": {
        "frdl/environment": "*",
    }
}

Usage

index.php

$environment = new Frdlweb\Environment\Environment;
$environment->path('/')
            ->detectEnvironment([
                'local' =>[
                    'required' => true,
                    'hosts' => ['your-machine-name']
                ]
            ]);

index.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

return [
        
        'secret-password' => 'secret-password-value'

    ];

.env.local.json

{
    "environment": "development"
}

$secret = getenv('secret-password');

Facades

If you wish, you can use environment library with facade connector. Please visit for guideline. ahir/facades

License

MIT