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.json
Fileautoload
Is:
autoload: { psr-4: { Xyz\\: src/lib/Xyz/ }}
Now I want to runcomposer install
To the databaseXyz
Add a global initialization function. Specifically, add a file.x.php
And the content of this file is as follows:
Equivalent,x.php
The file is the wholeXyz
The first thing the library executes is what other php files need.
Therefore, how to writecomposer.json
What about files?
Reply content:For example:
$ cd src/lib/Xyz/$ lsa.php b.php c.php
Thencomposer.json
Fileautoload
Is:
autoload: { psr-4: { Xyz\\: src/lib/Xyz/ }}
Now I want to runcomposer install
To the databaseXyz
Add a global initialization function. Specifically, add a file.x.php
And the content of this file is as follows:
Equivalent,x.php
The file is the wholeXyz
The first thing the library executes is what other php files need.
Therefore, how to writecomposer.json
What 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 andautoload
Fields can bepsr-4
A parallel field:files
Maybe it can be used. I took some time to try it and then replied.