Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Digisol's avatar

Class works on local dev environment, is not found in production

As the title says, this code executes perfectly in my local dev environment, I brought it into my linux production environment and now it is throwing an error.

Class "Amenadiel\JpGraph\Plot\PiePlot3d" not found
<?php

namespace App\Helpers;

use Amenadiel\JpGraph\Plot;
use Amenadiel\JpGraph\Graph;

class GraphCreation
{

  public static function create_pie_graph(array $data, array $dimensions, string $title, string $file_name)
  {
    $colours = ['#c73c32', '#378520', '#207685', '#4c2085', '#852059'];
    $graph = new Graph\PieGraph($dimensions[0], $dimensions[1]);
    $graph->title->Set($title);
    $graph->SetBox(true);
    $pie   = new Plot\PiePlot3d($data);
    $pie->SetSize(150);
    $pie->SetLabelPos(.5);
    $pie->value->SetColor('white');

    $pie->ShowBorder();

    $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));
  }

  public static function create_plotline_graph(array $data1, array $data2, array $data3, array $data4, array $dimensions, string $title, string $file_name, string $lang)
  {
    $graph = new Graph\Graph($dimensions[0], $dimensions[1]);
    $graph->SetScale("textlin");

    $graph->SetMargin(40, 20, 33, 58);

    $graph->title->Set($title);
    $graph->SetBox(false);

    $graph->yaxis->HideZeroLabel();
    $graph->yaxis->HideLine(false);
    $graph->yaxis->HideTicks(false, false);
    $graph->yaxis->SetTitle('Millions', 'middle');
    $graph->yaxis->SetTitleMargin(15);
    $graph->yaxis->SetTitleSide('SIDE_RIGHT');


    $graph->xaxis->SetTickLabels(array('2017', '2018', '2019', '2020', '2021'));
    $graph->ygrid->SetFill(false);

    $p1 = new Plot\LinePlot($data1);
    $graph->Add($p1);

    $p2 = new Plot\LinePlot($data2);
    $graph->Add($p2);

    $p3 = new Plot\LinePlot($data3);
    $graph->Add($p3);

    $p4 = new Plot\LinePlot($data4);
    $graph->Add($p4);

    $p1->SetColor('#0B84A5');


    $p1->SetLegend($lang == 'en' ? 'Balance' : 'FR');
    $p1->mark->SetType(MARK_FILLEDCIRCLE, '', 1.0);
    $p1->mark->SetColor('#0B84A5');
    $p1->mark->SetFillColor('#0B84A5');
    $p1->SetCenter();

    $p2->SetColor('#6F4E7C');


    $p2->SetLegend($lang == 'en' ? 'Can. Imports' : 'FR');
    $p2->mark->SetType(MARK_UTRIANGLE, '', 1.0);
    $p2->mark->SetColor('#6F4E7C');
    $p2->mark->SetFillColor('#6F4E7C');
    $p2->value->SetMargin(14);
    $p2->SetCenter();

    $p3->SetColor('#CA472F');
    $p3->SetLegend($lang == 'en' ? 'Can. Exports' : 'FR');
    $p3->mark->SetType(MARK_DTRIANGLE, '', 1.0);
    $p3->mark->SetColor('#CA472F');
    $p3->mark->SetFillColor('#CA472F');
    $p3->value->SetMargin(14);
    $p3->SetCenter();

    $p4->SetColor('#FFA056');
    $p4->SetLegend($lang == 'en' ? 'Total Trade' : 'FR');
    $p4->mark->SetType(MARK_STAR, '', 1.0);
    $p4->mark->SetColor('#FFA056');
    $p4->mark->SetFillColor('#FFA056');
    $p4->value->SetMargin(14);
    $p4->SetCenter();

    $graph->legend->SetFrameWeight(0);
    $graph->legend->SetColor('#4E4E4E', '#00A78A');
    $graph->legend->SetMarkAbsSize(8);
    // Output line

    $graph->xaxis->SetPos("min");
    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));
  }
}

Composer is installed, updated, and I ran a dump-autoload. It just can't find the class anymore.

0 likes
1 reply
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Most likely there is some difference in case. On linux it's case sensitive. On Mac and windows it isn't

Maybe 3d is actually 3D?

1 like

Please or to participate in this conversation.