How to replace a class in a third-party package with composer

Source: Internet
Author: User
Tags autoload
Fox example:
In a third-party package with a Flarum\Core\UserClass
And now I've written myself a Flarum\Core\UserClass
I want composer to automatically load with the one I created myself. Userclass, how to do to?

The method has been found, the namespace is the original namespace of that class, so it composer will automatically load the class I wrote.

"autoload": {    "classmap": [        "vendor/path/to/src/User.php"    ]},

Reply content:

Fox example:
A third-party package with a Flarum\Core\User class
When I write a class myself now Flarum\Core\User
I want to let composer automatically load using the class I created myself User , how to do?

The method has been found, the namespace is the original namespace of that class, so it composer will automatically load the class I wrote.

"autoload": {    "classmap": [        "vendor/path/to/src/User.php"    ]},

Have a third-party library, you want to rewrite it, and load your rewritten code, is that what this means?
If your third-party library is hosted on GitHub, you fork the project, then clone to local, modify and push to GitHub, and then composer.json reference the address of your fork project in it.

  • 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.