As in the following database file: {code ...} then composer. in the json file, autoload is: {code ...} now I want to add a global initialization function to the database Xyz when running composerinstall. Specifically, add the file x. php, and the content of this file is as follows :... for example:
$ cd src/lib/Xyz/$ lsa.php b.php c.php
Thencomposer.jsonFileautoloadIs:
autoload: { psr-4: { Xyz\\: src/lib/Xyz/ }}
Now I want to runcomposer installTo the databaseXyzAdd a global initialization function. Specifically, add a file.x.phpAnd the content of this file is as follows:
Equivalent,x.phpThe file is the wholeXyzThe first thing the library executes is what other php files need.
Therefore, how to writecomposer.jsonWhat about files?
Reply content:
For example:
$ cd src/lib/Xyz/$ lsa.php b.php c.php
Thencomposer.jsonFileautoloadIs:
autoload: { psr-4: { Xyz\\: src/lib/Xyz/ }}
Now I want to runcomposer installTo the databaseXyzAdd a global initialization function. Specifically, add a file.x.phpAnd the content of this file is as follows:
Equivalent,x.phpThe file is the wholeXyzThe first thing the library executes is what other php files need.
Therefore, how to writecomposer.jsonWhat about files?
Put require in the first PHP file in your library.
Does composer seem to be used for this purpose? It only manages dependencies, not the code in the package. You can modify the source code of your Xyz database by yourself.
@ Leunggamciu @ incNick Thank you. In the source code entry file, require is a solution. I just want to know if composer has such a method. I checked the information andautoloadFields can bepsr-4A parallel field:filesMaybe it can be used. I took some time to try it and then replied.