Welcome Guest, Not a member yet? Register   Sign In
$psr4 and namespace
#3

(03-31-2024, 06:50 PM)kenjis Wrote: Why don't you use Composer to install the library?
It configures autoloader automatically.

But your config in app/Config/autoload.php seems valid.
PHP Code:
'Goat1000\\SVGGraph' => APPPATH 'Libraries\Goat1000\SVGGraph' 

How do you call the libarary?

Thank you for your answer, Kenjis.
Sorry, I forgot to mention that I also tried to install the library with Composer, but it didn't make any change to the autoloader, at least I didn't see any change.

This is my controller with the method where I call the library (just the example given by the author):
Code:
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use CodeIgniter\Shield\Auth;
use App\Libraries\Goat1000\SVGGraph\autoloader;
use App\Libraries\Goat1000\SVGGraph\SVGGraph;

class Catalogue extends BaseController {
...

public function makeGraph() {
$graph = new SVGGraph(640, 480);
$graph->colours(['red','green','blue']);
$graph->values(100, 200, 150);
$graph->links('/Tom/', '/Dick/', '/Harry/');
$graph->render('BarGraph')
}
Reply


Messages In This Thread
$psr4 and namespace - by PhilInLoco - 03-31-2024, 01:27 PM
RE: $psr4 and namespace - by kenjis - 03-31-2024, 06:50 PM
RE: $psr4 and namespace - by PhilInLoco - 04-01-2024, 02:00 AM
RE: $psr4 and namespace - by kenjis - 04-01-2024, 02:06 AM
RE: $psr4 and namespace - by PhilInLoco - 04-01-2024, 02:21 AM
RE: $psr4 and namespace - by kenjis - 04-01-2024, 02:26 AM
RE: $psr4 and namespace - by PhilInLoco - 04-01-2024, 02:37 AM
RE: $psr4 and namespace - by InsiteFX - 04-01-2024, 03:56 AM
RE: $psr4 and namespace - by PhilInLoco - 04-01-2024, 06:04 AM
RE: $psr4 and namespace - by kenjis - 04-01-2024, 06:01 PM
RE: $psr4 and namespace - by PhilInLoco - 04-02-2024, 05:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB