I am learning to compose and libraries. the folder where I find a problem is on: https://github.com/raoufcode/comp I installed Composer on my Windows, then I created local classes (src folder) and at the same time I imported a library (erusev / parsedown) via the command line. the problem is that the library works fine when I instantiate it but my own class located in the Fag.php folder in the source folder does not work when I call with use in index.php. When I require my class file, it works but I want composer to do the job dynamically Any solutions for my own class so that it works with Composer please?
Asked
Active
Viewed 79 times
2 Answers
0
I think that when you say "dynamic instantiation" you want to mean class autoloading, So I supose that you should learn how to config the autoloader of composer. That's a link that could be useful.

Ryan
- 1
-1
Depending on your git repo, that you linked I can only find following problem:
You try to load the class before the autoloader registerd.
You index.php should look like this:
<?php
require_once 'vendor/autoload.php'; // only the autoloader needed to include
use Try\Fag; // use need to be after the auto loader
$fag= new Fag();
You already auto load your class with your composer config autload/psr-4

Sysix
- 1,572
- 1
- 16
- 23