Search code examples
phplaravelcomposer-phpautoloadchargebee

Class Not Found on Chargebee Library in Laravel


I installed Chargebee library to my Laravel web (v5.7). But when I want to use the library, all the class from the library is not found. Here is my code on the controller

<?php

namespace App\Api\V2\Controllers;

use Chargebee\ChargeBee\Environment as ChargeBee_Environment;
use Chargebee\ChargeBee\Models\Plan as ChargeBee_Plan;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class ChargebeeController extends Controller
{
  public function retrieveItem($plan) {
    ChargeBee_Environment::configure(env('CHARGEBEE_ENVIRONMENT'), env('CHARGEBEE_KEY'));
    return $plan_response = ChargeBee_Plan::retrieve($plan);
  }
}

The Chargebee\ChargeBee\Environment and Chargebee\ChargeBee\Models\Plan is not found.


Solution

  • I finally found my answer. Apparently it's supposed to be ChargeBee\ChargeBee. The 'B' should be capital.