PHP code example of boomdraw / laravel-dotenv

1. Go to this page and download the library: Download boomdraw/laravel-dotenv library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

boomdraw / laravel-dotenv example snippets


use Dotenv;
//or
use Boomdraw\Dotenv\Facades\Dotenv;
//or
use Boomdraw\Dotenv\Contracts\DotenvContract;

class Controller
{
    /**
     * @var \Boomdraw\Dotenv\Repositories\DotenvRepository
     */
    protected $dotenv;

    public function __construct(DotenvContract $dotenv)
    {
        $this->dotenv = $dotenv;
    }
}

Dotenv::all(): Collection

Dotenv::set($key, ?string $value = null): self

Dotenv::setEmpty($key, ?string $value = null): self

Dotenv::add($key, ?string $value = null): self

Dotenv::put($key, ?string $value = null): self

Dotenv::putEmpty($key, ?string $value = null): self

Dotenv::delete($key): self

Dotenv::reload(): self
bash
php artisan vendor:publish --provider="Boomdraw\Dotenv\DotenvServiceProvider" --tag="config"