We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

where to include composer packages

Hi

this is my first day in phalcon

just wondering where should i include my compsoer packages in public/index.php and if yes where exactly?

In phalcon 3.0 you can just load files using phalcon loader. You can include them whereever you want. In service definition or just in loader or whatever.



2.2k
edited Aug '16

@Jurigag you mean like this

$loader = new Loader();
$loader->registerDirs(
    array(
        '../autoload.php'
    )
)->register();

or what?

If you mean the vendor/autoload.php, then include it in your loader.php file - if you follow conventional phalcon struct. Otherwise, include it where Phalcon\Loader is initialized.



2.2k
edited Aug '16

yes i mean vendor/autoload.php @lajosbencz

and i have only app and public folders no file called loader.php

my first day in phalcon :)



2.2k

@Jurigag im sorry i don't understand

i have app & public folders now i want to load the compseor packages

where exactly ?and how?

Just load composer autoloader with method i wrote above :)



2.2k
edited Aug '16
$loader = new Loader();
$loader->registerFiles(
    array(
        'file.php',
    )
)->register();

gives error

Fatal error: Call to undefined method Phalcon\Loader::registerFiles()

Then you are not using phalcon 3.0 :)