Skip to content

Commit d9d1613

Browse files
committed
Won't be able to test and maintain laravel 4 integration
1 parent 724f5a8 commit d9d1613

File tree

4 files changed

+20
-119
lines changed

4 files changed

+20
-119
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,21 @@ Add the package to the `require` list of your `composer.json` file.
2929

3030
and run `composer install` to get the latest version of the package.
3131

32-
### Laravel 4/5 integration
32+
### Laravel 5 integration
3333

3434
In the $providers array add the service providers for this package:
3535

36-
'Scriptotek\Sru\Providers\SruServiceProvider'
36+
Scriptotek\Sru\Providers\SruServiceProvider::class,
3737

3838
Add the facade of this package to the `$aliases` array:
3939

40-
'SruClient' => 'Scriptotek\Sru\Facades\SruClient'
40+
'SruClient' => Scriptotek\Sru\Facades\SruClient::class,
4141

4242
Publish configuration in Laravel 5:
4343

44-
$ php artisan vendor:publish --provider="Scriptotek\Sru\Providers\SruServiceProviderLaravel5"
44+
$ php artisan vendor:publish --provider="Scriptotek\Sru\Providers\SruServiceProvider"
4545

46-
Publish configuration in Laravel 4:
47-
48-
$ php artisan config:publish scriptotek/sru
49-
50-
In Laravel 5 applications the configuration file is copied to `config/sru.php`, in Laravel 4 applications you will find the file at `app/config/packages/scriptotek/sru/config.php`.
46+
The configuration file is copied to `config/sru.php`.
5147

5248
### Example
5349

src/Providers/SruServiceProvider.php

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,61 +7,37 @@
77

88
class SruServiceProvider extends ServiceProvider
99
{
10-
/**
11-
* Indicates if loading of the provider is deferred.
12-
*
13-
* @var bool
14-
*/
15-
protected $defer = false;
16-
/**
17-
* Actual provider
18-
*
19-
* @var \Illuminate\Support\ServiceProvider
20-
*/
21-
protected $provider;
22-
/**
23-
* Create a new service provider instance.
24-
*
25-
* @param \Illuminate\Contracts\Foundation\Application $app
26-
* @return void
27-
*/
28-
public function __construct($app)
29-
{
30-
parent::__construct($app);
31-
$this->provider = $this->getProvider();
32-
}
10+
3311
/**
3412
* Bootstrap the application events.
3513
*
3614
* @return void
3715
*/
3816
public function boot()
3917
{
40-
return $this->provider->boot();
18+
$this->publishes(array(
19+
__DIR__.'/../../config/config.php' => config_path('sru.php')
20+
));
4121
}
22+
4223
/**
4324
* Register the service provider.
4425
*
4526
* @return void
4627
*/
4728
public function register()
4829
{
49-
return $this->provider->register();
50-
}
51-
/**
52-
* Return ServiceProvider according to Laravel version
53-
*
54-
* @return \Scriptotek\Sru\Provider\ProviderInterface
55-
*/
56-
private function getProvider()
57-
{
58-
if (version_compare(Application::VERSION, '5.0', '<')) {
59-
$provider = '\Scriptotek\Sru\SruClientProviderLaravel4';
60-
} else {
61-
$provider = '\Scriptotek\Sru\SruClientProviderLaravel5';
62-
}
63-
return new $provider($this->app);
30+
$app = $this->app;
31+
$this->mergeConfigFrom(
32+
__DIR__.'/../../config/config.php',
33+
'sru'
34+
);
35+
$app['sru-client'] = $app->share(function ($app) {
36+
return new SruClient($app['config']->get('sru.endpoint'), $app['config']->get('sru'));
37+
});
38+
$app->alias('sru-client', 'Scriptotek\Sru\Client');
6439
}
40+
6541
/**
6642
* Get the services provided by the provider.
6743
*

src/Providers/SruServiceProviderLaravel4.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/Providers/SruServiceProviderLaravel5.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)