Skip to content

Commit 68db1de

Browse files
Upgraded to the native L5 config system
1 parent d966a8d commit 68db1de

File tree

4 files changed

+38
-14
lines changed

4 files changed

+38
-14
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ Checkout the [1.0 branch](https://github.com/GrahamCampbell/Laravel-Parse/tree/1
3737

3838
## Configuration
3939

40-
Laravel Parse requires configuration through [orchestral/config](https://github.com/orchestral/config).
40+
Laravel Parse requires configuration/
4141

42-
If you want an automated way to publish the config, then install [orchestral/publisher](https://github.com/orchestral/publisher).
43-
44-
You can then publish the config file by running:
42+
To get started, you'll need to publish all vendor assets:
4543

4644
```bash
47-
$ php artisan publish:config graham-campbell/parse
45+
$ php artisan vendor:publish
4846
```
4947

48+
This will create a `config/parse.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.
49+
5050
There are three config options:
5151

5252
##### Parse App Id

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
],
1212
"require": {
1313
"php": ">=5.4.7",
14+
"illuminate/contracts": "5.0.*",
1415
"illuminate/support": "5.0.*",
15-
"orchestra/config": "3.0.*",
16-
"orchestra/support-providers": "3.0.*",
1716
"parse/php-sdk": "~1.0"
1817
},
1918
"require-dev": {
File renamed without changes.

src/ParseServiceProvider.php

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
namespace GrahamCampbell\Parse;
1313

14-
use Orchestra\Support\Providers\ServiceProvider;
14+
use Illuminate\Contracts\Foundation\Application;
15+
use Illuminate\Support\ServiceProvider;
1516
use Parse\ParseClient;
1617

1718
/**
@@ -28,13 +29,37 @@ class ParseServiceProvider extends ServiceProvider
2829
*/
2930
public function boot()
3031
{
31-
$this->addConfigComponent('graham-campbell/parse', 'graham-campbell/parse', realpath(__DIR__.'/../config'));
32+
$this->setupConfig();
3233

33-
ParseClient::initialize(
34-
$this->app->config->get('graham-campbell/parse::app_id'),
35-
$this->app->config->get('graham-campbell/parse::rest_key'),
36-
$this->app->config->get('graham-campbell/parse::master_key')
37-
);
34+
$this->setupParse($this->app);
35+
}
36+
37+
/**
38+
* Setup the config.
39+
*
40+
* @return void
41+
*/
42+
protected function setupConfig()
43+
{
44+
$source = realpath(__DIR__.'/../config/parse.php');
45+
46+
$this->publishes([$source => config_path('parse.php')]);
47+
48+
$this->mergeConfigFrom('parse', $source);
49+
}
50+
51+
/**
52+
* Setup parse.
53+
*
54+
* @param \Illuminate\Contracts\Foundation\Application $app
55+
*
56+
* @return void
57+
*/
58+
protected function setupParse(Application $app)
59+
{
60+
$config = $app->config->get('parse');
61+
62+
ParseClient::initialize($config['app_id'], $config['rest_key'], $config['master_key']);
3863
}
3964

4065
/**

0 commit comments

Comments
 (0)