Skip to content

Commit ef696a5

Browse files
committed
support for Laravel 5.*
1 parent b35d998 commit ef696a5

File tree

3 files changed

+68
-9
lines changed

3 files changed

+68
-9
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Laravel Environments ![CircleCI](https://circleci.com/gh/highsolutions/laravel-environments.svg?style=svg) ![StyleCI](https://styleci.io/repos/118597081/shield?branch=master)
1+
Laravel Environments
22
================
33

4+
![CircleCI](https://circleci.com/gh/highsolutions/laravel-environments.svg?style=svg) ![StyleCI](https://styleci.io/repos/118597081/shield?branch=master) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg?style=flat-square)](https://opensource.org/licenses/MIT)
5+
46
Easy management of different environments in Laravel projects.
57

68
![Laravel-Environments by HighSolutions](https://github.com/highsolutions/laravel-environments/master/intro.jpg)
@@ -18,10 +20,18 @@ Or by adding the following line to the `require` section of your Laravel webapp'
1820

1921
```javascript
2022
"require": {
21-
"HighSolutions/laravel-environments": "1.*"
23+
"HighSolutions/laravel-environments": "2.*"
2224
}
2325
```
2426

27+
If you are using Laravel <= 5.4, update `config/app.php` by adding an entry for the service provider:
28+
29+
```php
30+
'providers' => [
31+
// ...
32+
HighSolutions\LaravelEnvironments\EnvironmentServiceProvider::class,
33+
];
34+
2535
Optionally, publish the configuration file if you want to change any defaults:
2636

2737
```bash
@@ -118,6 +128,9 @@ vendor/bin/phpunit
118128
Changelog
119129
---------
120130

131+
2.0.0
132+
* Support for all Laravel 5.* versions (to-date)
133+
121134
1.6.0
122135
* Laravel 5.6 support
123136

composer.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@
1010
],
1111
"license": "MIT",
1212
"require": {
13-
"php": ">=7.1.3",
14-
"illuminate/console": "~5.6.0",
15-
"illuminate/support": "~5.1"
13+
"php": ">=5.4.0",
14+
"illuminate/console": "5.*",
15+
"illuminate/support": "5.*"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "^7.0",
19-
"orchestra/testbench" : "~3.6.0",
18+
"phpunit/phpunit": "6.*|7.*",
19+
"orchestra/testbench" : "3.*",
2020
"mockery/mockery": "^1.0"
2121
},
2222
"autoload": {
2323
"psr-4": {
2424
"HighSolutions\\LaravelEnvironments\\": "src/"
25-
}
25+
},
26+
"files": [
27+
"src/helpers.php"
28+
]
2629
},
2730
"autoload-dev": {
2831
"psr-4": {
@@ -34,7 +37,15 @@
3437
},
3538
"extra": {
3639
"component": "package",
37-
"frameworks": ["Laravel 5.6"],
40+
"frameworks": [
41+
"Laravel 5.0",
42+
"Laravel 5.1",
43+
"Laravel 5.2",
44+
"Laravel 5.3",
45+
"Laravel 5.4",
46+
"Laravel 5.5",
47+
"Laravel 5.6"
48+
],
3849
"laravel": {
3950
"providers": [
4051
"HighSolutions\\LaravelEnvironments\\EnvironmentServiceProvider"

src/helpers.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
/*
4+
* Helpers compatibility
5+
*/
6+
7+
if (! function_exists('str_before')) {
8+
/**
9+
* Get the portion of a string before a given value.
10+
*
11+
* @param string $subject
12+
* @param string $search
13+
* @return string
14+
*/
15+
function str_before($subject, $search)
16+
{
17+
return $search === '' ? $subject : explode($search, $subject)[0];
18+
}
19+
}
20+
21+
if (! function_exists('str_finish')) {
22+
/**
23+
* Cap a string with a single instance of a given value.
24+
*
25+
* @param string $value
26+
* @param string $cap
27+
* @return string
28+
*/
29+
function str_finish($value, $cap)
30+
{
31+
$quoted = preg_quote($cap, '/');
32+
33+
return preg_replace('/(?:'.$quoted.')+$/u', '', $value).$cap;
34+
}
35+
}

0 commit comments

Comments
 (0)