shahr's avatar
Level 10

Fatal error: Uncaught Error: Call to undefined function Dotenv\Dotenv()

I am trying to build a website to practice a code where. I am finding a strange error

errpr

Which I am unable to replicate how to solve the issue.

I have followed the steps.

I already downloaded the Vendor by Composer and here is the code I have used.

folders

.env

APP_URL=http://oxbir.me
APP_ENV=local
APP_NAME="ACSE E-Commerce Store"

index.php

<?php
require_once __DIR__.'/../bootstrap/init.php';
$app_name = getenv('APP_NAME');
echo $app_name;

init.php

<?php
require_once __DIR__.'/../app/config/_env.php';

_env.php

<?php
define('BASE_PATH', realpath(__DIR__.'/../../'));
require_once __DIR__.'/../../vendor/autoload.php';
$dotEnv = Dotenv\Dotenv(BASE_PATH);
$dotEnv->load();
0 likes
0 replies

Please or to participate in this conversation.