Autoload error when using Highchartsphp

Asked

Viewed 108 times

0

I’m including in my Komposer "ghunti/highcharts-php": "~3.0" and after that my autoload stops working resulting in the fatal error below, which could be?

Fatal error: Call to Undefined method Composer Autoload Classloader::setPsr4() in /Users/my-user/my-project/dev/vendor/Composer/autoload_real.php on line 37

1 answer

1


Check your Poser and the file vendor/autoload.php are up to date.

Before executing the composer update, execute the commands below:

To update the Composer:

composer selfupdate

To generate the vendor/autoload.php:

composer dump-autoload

At the end, make sure you are importing properly the namespaces needed through use

Here is an example of a page working with the instance of Highcharts

<?php

require 'vendor/autoload.php';

use Ghunti\HighchartsPHP\Highchart;

$chart = new Highchart();

var_dump($chart);
  • I ran but still the problem persists.

  • Same mistake Daniel?

  • Yeah, same mistake, I think it’s something to do with psr-4. He says the function doesn’t exist but if I open the Classloader the function setPsr4 is right there.

  • @Daniel edited my answer, if it doesn’t work edit your question and include your composer.json. I made a new design using this library and is working smoothly.

  • I created a new project here and it worked well too, I believe it must be conflict with some other library of my project, I will try to find out what it is now. Thank you.

  • Daniel, in case you need help post your composer.json

  • I found the problem. I have a subproject with your Composer.json specific that was overwriting the Composer.json global.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.