Can you show your composer autoload ?
Sep 14, 2022
8
Level 1
Helper not recognizing Classes
I am attempting to write a Helper function to create graphs. I have included my app/helper.php file in the composer autoload, however when I attempt to run the following code, the classes aren't found.
<?php
use App\Amenadiel\JpGraph\Graph;
use App\Amenadiel\JpGraph\Plot;
function create_pie_graph(array $data, array $dimensions, string $title, string $file_name){
$colours = ['#8D201C', '#EE8310', '#2A7DA6', '#5A306B', '#285228'];
$graph = new Graph/PieGraph($dimensions[0],$dimensions[1]);
$graph->title->Set($title);
$graph->SetBox(true);
$pie = new Plot\PiePlot($data);
$pie->ShowBorder();
$pie->SetColor('black');
$pie->SetSliceColors($colours);
$graph->Add($pie);
if(file_exists(storage_path('app/public/charts/'.$file_name))){
unlink(storage_path('app/public/charts/'.$file_name));
}
$graph->Stroke(storage_path('app/public/charts/'.$file_name));
}
Please or to participate in this conversation.