Issue
I'm a beginner in php, I'm trying to use a library but I'm facing an error
Fatal error: Uncaught Error: Class 'Einenlum\LingueeApi\Factory' not found in C:\xampp\htdocs\index.php:4 Stack trace: #0 {main} thrown in C:\xampp\htdocs\index.php on line 4
I followed correctly what it says in the readme file my code is like this:
<?php
use Einenlum\LingueeApi\Factory;
$linguee = Factory::create();
$response = $linguee->translate('desert', 'eng', 'ger');
echo $response->toJson();
?>
I'm not sure if this readme file is giving me correct information, how can I run this project?
Solution
Since that library/package is managed via composer
you'd need to use composer
's autoload:
<?php
require __DIR__ . '/vendor/autoload.php';
use Einenlum\LingueeApi\Factory;
...
Find more information at https://getcomposer.org/doc/01-basic-usage.md#autoloading
Answered By - brombeer
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.