This repository was archived by the owner on Feb 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +43
-6
lines changed
src/Ipunkt/LaravelAnalytics Expand file tree Collapse file tree 3 files changed +43
-6
lines changed Original file line number Diff line number Diff line change 1- # Analytics tracking package for Laravel 4.x
1+ # Analytics tracking package for Laravel
22
33[ ![ Latest Stable Version] ( https://poser.pugx.org/ipunkt/laravel-analytics/v/stable.svg )] ( https://packagist.org/packages/ipunkt/laravel-analytics ) [ ![ Latest Unstable Version] ( https://poser.pugx.org/ipunkt/laravel-analytics/v/unstable.svg )] ( https://packagist.org/packages/ipunkt/laravel-analytics ) [ ![ License] ( https://poser.pugx.org/ipunkt/laravel-analytics/license.svg )] ( https://packagist.org/packages/ipunkt/laravel-analytics ) [ ![ Total Downloads] ( https://poser.pugx.org/ipunkt/laravel-analytics/downloads.svg )] ( https://packagist.org/packages/ipunkt/laravel-analytics )
44
@@ -10,14 +10,25 @@ Add to your composer.json following lines
1010 "ipunkt/laravel-analytics": "~1.0"
1111 }
1212
13+ ### With Laravel 5
14+
15+ Run ` php artisan vendor:publish ipunkt/laravel-analytics `
16+
17+ Then edit ` analytics.php ` in ` app/config ` to your needs.
18+
19+ Add ` 'Ipunkt\LaravelAnalytics\AnalyticsServiceProvider', ` to ` providers ` in ` app/config/app.php ` .
20+
21+ Optional: Add ` 'Analytics' => 'Ipunkt\LaravelAnalytics\AnalyticsFacade', ` to ` aliases ` in ` app/config/app.php ` .
22+
23+ ### With Laravel 4
24+
1325Run ` php artisan config:publish ipunkt/laravel-analytics `
1426
1527Then edit ` analytics.php ` in ` app/config/packages/ipunkt/laravel-analytics ` to your needs.
1628
1729Add ` 'Ipunkt\LaravelAnalytics\AnalyticsServiceProvider', ` to ` providers ` in ` app/config/app.php ` .
1830
19- Add ` 'Analytics' => 'Ipunkt\LaravelAnalytics\AnalyticsFacade', ` to ` aliases ` in ` app/config/app.php ` .
20-
31+ Optional: Add ` 'Analytics' => 'Ipunkt\LaravelAnalytics\AnalyticsFacade', ` to ` aliases ` in ` app/config/app.php ` .
2132
2233## Configuration
2334
Original file line number Diff line number Diff line change 1212 ],
1313 "require" : {
1414 "php" : " >=5.4.0" ,
15- "illuminate/support" : " ~4.0" ,
16- "illuminate/session" : " ~4.0"
15+ "illuminate/support" : " ~4.0|~5.0" ,
16+ "illuminate/session" : " ~4.0|~5.0" ,
17+ "illuminate/config" : " ~4.0|~5.0"
18+ },
19+ "require-dev" : {
20+ "laravel/framework" : " ~4.0|~5.0"
1721 },
1822 "autoload" : {
1923 "psr-0" : {
Original file line number Diff line number Diff line change @@ -19,7 +19,19 @@ class AnalyticsServiceProvider extends ServiceProvider
1919 */
2020 public function boot ()
2121 {
22- $ this ->package ('ipunkt/laravel-analytics ' );
22+ if ($ this ->isLaravel4 ()) {
23+ $ this ->package ('ipunkt/laravel-analytics ' );
24+
25+ return ;
26+ }
27+
28+ $ config = realpath (__DIR__ . '/../../config/analytics.php ' );
29+
30+ $ this ->mergeConfigFrom ($ config , 'analytics ' );
31+
32+ $ this ->publishes ([
33+ $ config => config_path ('analytics.php ' ),
34+ ]);
2335 }
2436
2537 /**
@@ -57,4 +69,14 @@ public function provides()
5769 {
5870 return array ();
5971 }
72+
73+ /**
74+ * are we on laravel 4
75+ *
76+ * @return bool
77+ */
78+ private function isLaravel4 ()
79+ {
80+ return version_compare (\Illuminate \Foundation \Application::VERSION , '5 ' , '< ' );
81+ }
6082}
You can’t perform that action at this time.
0 commit comments