While I'm using socialite providers plugin in Laravel to authenticate with Microsoft O365. But some functions (including the scope) in a file of the plugin is not working properly. So I need to override that file as a solutions to it.
How to override a file in vendor folder ?
I have tried few solutions found here but not worked.
CodePudding user response:
Instead of changing the vendor file, you should create your own class that extends from it and add/override whatever you need to your class. Your class will inherit all the functions of the base class
CodePudding user response:
You can override a vendor class at the composer level as below however if it's possible extending will be more right decision.
You have to apply the update on the composer.json
of your project. It's a sample that overrides to the PhpExecutableFinder.php
of Symfony framework. In this case, there have to be a file named exactly same under overrides/symfony/process/
path.
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": "overrides/symfony/process/"
},
"exclude-from-classmap": [
"vendor/symfony/process/PhpExecutableFinder.php"
],
},
Further information about the autoload
tag please take a look documentation.