如何在 Laravel 5.5 中扩展供应商软件包服务提供商
我正在使用一个集成Xero会计的软件包。
它们在以下位置调用了一个文件:。XeroServiceProvider.php
/vendor/drawmyattention/xerolaravel/Providers/XeroServiceProvider.php
我需要在我的应用程序中扩展此服务提供程序,但我不喜欢直接编辑此文件的想法。
有没有办法在不更新供应商文件的情况下轻松扩展此服务提供商?
以下是我需要扩展的文件:
namespace DrawMyAttention\XeroLaravel\Providers;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Support\ServiceProvider;
use \App\Invoice;
class XeroServiceProvider extends ServiceProvider
{
private $config = 'xero/config.php';
public function boot()
{
$this->publishes([
__DIR__.'/../config.php' => config_path($this->config),
]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('XeroInvoice', function(){
//return new \XeroPHP\Models\Accounting\Invoice();
return new Invoice();
});
}
}