diff --git a/README.md b/README.md index 3a765b5..80cb30b 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,17 @@ This Laravel 4 package provides an interface for using [Salesforce CRM](http://w [![Latest Stable Version](https://img.shields.io/packagist/v/davispeixoto/laravel-salesforce.svg)](https://packagist.org/packages/davispeixoto/laravel-salesforce) [![Total Downloads](https://img.shields.io/packagist/dt/davispeixoto/laravel-salesforce.svg)](https://packagist.org/packages/davispeixoto/laravel-salesforce) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/davispeixoto/Laravel-4-Salesforce/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/davispeixoto/Laravel-4-Salesforce/?branch=master) +[![Code Coverage](https://scrutinizer-ci.com/g/davispeixoto/Laravel-4-Salesforce/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/davispeixoto/Laravel-4-Salesforce/?branch=master) [![Codacy Badge](https://www.codacy.com/project/badge/a0e8c76d048d441194d4cfb03642bd0c)](https://www.codacy.com/app/davis-peixoto/Laravel-4-Salesforce) [![Code Climate](https://codeclimate.com/github/davispeixoto/Laravel-4-Salesforce/badges/gpa.svg)](https://codeclimate.com/github/davispeixoto/Laravel-4-Salesforce) [![Build Status](https://travis-ci.org/davispeixoto/Laravel-4-Salesforce.svg?branch=2.0.5)](https://travis-ci.org/davispeixoto/Laravel-4-Salesforce) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/3b9313d5-1340-4459-9973-070e19c289bc/small.png)](https://insight.sensiolabs.com/projects/3b9313d5-1340-4459-9973-070e19c289bc) +## Major update notice (3.*) +I have recently changed this package structure for addressing [this issue](https://github.com/davispeixoto/Laravel-4-Salesforce/issues/13). +This change will require the alias declaration into `app/config/app.php` once the package initialization is now deferred. +**Please verify aliases before upgrading existing implementations to use this version** + ## Installation Begin by installing this package through Composer. Edit your project's `composer.json` file to require `davispeixoto/laravel-salesforce`. @@ -17,7 +23,7 @@ Begin by installing this package through Composer. Edit your project's `composer ```json "require": { "laravel/framework": "4.*", - "davispeixoto/laravel-salesforce": "2.0.*" + "davispeixoto/laravel-salesforce": "3.0.*" } ``` @@ -41,10 +47,20 @@ Ensure you put [your WSDL file](https://www.salesforce.com/us/developer/docs/api **IMPORTANT:** the PHP Force.com Toolkit for PHP only works with Enterprise WSDL -Finally add the service provider. Open `app/config/app.php`, and add a new item to the providers array. +Finally add the service provider. Open `app/config/app.php`, and add a new item to the providers and aliases arrays. ```php - 'Davispeixoto\LaravelSalesforce\LaravelSalesforceServiceProvider' + 'providers' => array( + // other Laravel service providers ... + 'Davispeixoto\LaravelSalesforce\LaravelSalesforceServiceProvider' + ), + + ... + + 'aliases' => array( + // other Laravel aliases + 'Salesforce' => 'Davispeixoto\LaravelSalesforce\Facades\Salesforce' + ); ``` That's it! You're all set to go. Just use: @@ -84,4 +100,4 @@ who kindly empower this project with a free open-source license for [PhpStorm](h [1]: https://www.jetbrains.com/ [2]: https://www.jetbrains.com/company/docs/logo_jetbrains.png [3]: https://www.jetbrains.com/phpstorm/ - [4]: https://www.jetbrains.com/phpstorm/documentation/docs/logo_phpstorm.png + [4]: https://d3nmt5vlzunoa1.cloudfront.net/phpstorm/files/2015/12/PhpStorm_400x400_Twitter_logo_white.png diff --git a/src/Davispeixoto/LaravelSalesforce/LaravelSalesforceServiceProvider.php b/src/Davispeixoto/LaravelSalesforce/LaravelSalesforceServiceProvider.php index 13b3875..6d3c97d 100644 --- a/src/Davispeixoto/LaravelSalesforce/LaravelSalesforceServiceProvider.php +++ b/src/Davispeixoto/LaravelSalesforce/LaravelSalesforceServiceProvider.php @@ -12,7 +12,7 @@ class LaravelSalesforceServiceProvider extends ServiceProvider * * @var bool */ - protected $defer = false; + protected $defer = true; /** * Bootstrap the application events. @@ -34,7 +34,6 @@ public function register() $this->app->booting(function () { $loader = \Illumintate\Foundation\AliasLoader::getInstance(); $loader->alias('Salesforce', 'Davispeixoto\LaravelSalesforce\Facades\Salesforce'); - $loader->alias('SF', 'Davispeixoto\LaravelSalesforce\Facades\Salesforce'); }); $this->app['salesforce'] = $this->app->share(function ($app) { diff --git a/src/Davispeixoto/LaravelSalesforce/Salesforce.php b/src/Davispeixoto/LaravelSalesforce/Salesforce.php index 49e5918..7bdeb48 100644 --- a/src/Davispeixoto/LaravelSalesforce/Salesforce.php +++ b/src/Davispeixoto/LaravelSalesforce/Salesforce.php @@ -2,6 +2,7 @@ use Davispeixoto\ForceDotComToolkitForPhp\SforceEnterpriseClient as Client; use SalesforceException; +use Exception; use Illuminate\Config\Repository; /**