How do I set the load order of composer?

Source: Internet
Author: User
Keywords composer php
Tags autoload composer install
The following library files are available:

$ cd src/lib/Xyz/$ lsa.php b.php c.php

Then the composer.json file autoload is:

autoload: {  psr-4: {    Xyz\\: src/lib/Xyz/  }}

Now I want to composer install add the global initialization function to the library at run time, Xyz specifically, add the file x.php , and the content of the file is this:


  
   

相当于说,x.php 文件是整个 Xyz 库最先执行的,是其他 php 文件需要的东西。

所以,该如何编写 composer.json 文件呢?

Reply content:

The following library files are available:

$ cd src/lib/Xyz/$ lsa.php b.php c.php

Then the composer.json file autoload is:

autoload: {  psr-4: {    Xyz\\: src/lib/Xyz/  }}

Now I want to composer install add the global initialization function to the library at run time, Xyz specifically, add the file x.php , and the content of the file is this:


  
    

相当于说,x.php 文件是整个 Xyz 库最先执行的,是其他 php 文件需要的东西。

所以,该如何编写 composer.json 文件呢?

Require it on the PHP file that was first executed in your library

Composer doesn't seem to be doing this, is it? It is only responsible for managing dependencies, not the code in the management package, you say this yourself modify your XYZ library source code is not on the line.

@leunggamciu @incNick Thank you, it's a way to require in the source code entry file. I just want to know if composer has this method, I checked the information, in the autoload field, a field that can be parallel to psr-4 : files may work, I took the time to try and then reply.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.