Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 0bf3544

Browse files
author
Andrey Helldar
authored
Merge pull request #15 from TheDragonCode/3.x
Changed namespace
2 parents 0f2bb02 + 7bfdc76 commit 0bf3544

File tree

18 files changed

+109
-928
lines changed

18 files changed

+109
-928
lines changed

.codecov.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.editorconfig

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

.github/workflows/coverage.yml

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

.github/workflows/phpunit.yml

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
name : phpunit
2-
on : [ push ]
1+
name: phpunit
2+
on: [ push ]
33

4-
jobs :
5-
build :
6-
runs-on : ubuntu-latest
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
77

8-
strategy :
9-
fail-fast : true
10-
matrix :
11-
php : [ "7.3", "7.4", "8.0" ]
12-
symfony : [ "4.0", "5.0" ]
13-
support : [ "2.0", "3.0", "4.0" ]
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [ "7.3", "7.4", "8.0" ]
12+
symfony: [ "4.0", "5.0" ]
1413

15-
name : PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, Support ${{ matrix.support }}
14+
name: PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}
1615

17-
steps :
18-
- name : Checkout code
19-
uses : actions/checkout@v2
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v2
2019

21-
- name : Setup PHP
22-
uses : shivammathur/setup-php@v2
23-
with :
24-
php-version : ${{ matrix.php }}
25-
extensions : curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
26-
coverage : none
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php }}
24+
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv
25+
coverage: none
2726

28-
- name : Install dependencies
29-
run : composer require symfony/finder:^${{ matrix.symfony }} andrey-helldar/support:^${{ matrix.support }}
27+
- name: Install dependencies
28+
run: composer require symfony/finder:^${{ matrix.symfony }}
3029

31-
- name : Execute tests
32-
run : sudo vendor/bin/phpunit
30+
- name: Execute tests
31+
run: sudo vendor/bin/phpunit

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,3 @@ build/
88
*.orig
99

1010
composer.lock
11-
12-
###> symfony/phpunit-bridge ###
13-
.phpunit
14-
.phpunit.result.cache
15-
/phpunit.xml
16-
###< symfony/phpunit-bridge ###

README.md

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,41 @@
22

33
<img src="https://preview.dragon-code.pro/TheDragonCode/env-sync.svg?brand=php" alt="Environment Synchronization"/>
44

5-
[![StyleCI Status][badge_styleci]][link_styleci]
6-
[![Github Workflow Status][badge_build]][link_build]
7-
[![Coverage Status][badge_coverage]][link_scrutinizer]
8-
[![Scrutinizer Code Quality][badge_quality]][link_scrutinizer]
9-
105
[![Stable Version][badge_stable]][link_packagist]
116
[![Unstable Version][badge_unstable]][link_packagist]
127
[![Total Downloads][badge_downloads]][link_packagist]
8+
[![Github Workflow Status][badge_build]][link_build]
139
[![License][badge_license]][link_license]
1410

1511

1612
## Installation
1713

18-
> If you are using the Laravel framework, then install the [andrey-helldar/env-sync-laravel](https://github.com/andrey-helldar/env-sync-laravel) package instead.
19-
>
20-
> If you are using the Symfony framework, then install the [andrey-helldar/env-sync-symfony](https://github.com/andrey-helldar/env-sync-symfony) package instead.
14+
> If you are using the Laravel framework, then install the [dragon-code/env-sync-laravel](https://github.com/TheDragonCode/env-sync-laravel) package instead.
2115
2216

2317
To get the latest version of `Environment Synchronization`, simply require the project using [Composer](https://getcomposer.org):
2418

2519
```bash
26-
$ composer require andrey-helldar/env-sync --dev
20+
$ composer require dragon-code/env-sync --dev
2721
```
2822

2923
Or manually update `require-dev` block of `composer.json` and run `composer update`.
3024

3125
```json
3226
{
3327
"require-dev": {
34-
"andrey-helldar/env-sync": "^2.0"
28+
"dragon-code/env-sync": "^3.0"
3529
}
3630
}
3731
```
3832

33+
### Upgrade from `andrey-helldar/env-sync`
34+
35+
1. In your `composer.json` file, replace "andrey-helldar/env-sync": "^1.0" with "dragon-code/env-sync": "^3.0".
36+
2. Replace the `Helldar\EnvSync` namespace with `DragonCode\EnvSync` in your app;
37+
3. Run the command `composer update`.
38+
4. Profit!
39+
3940
## How to use
4041

4142
> This package scans files with `*.php`, `*.json`, `*.yml`, `*.yaml` and `*.twig` extensions in the specified folder, receiving from them calls to the `env` and `getenv` functions.
@@ -45,15 +46,14 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda
4546
4647
### Frameworks
4748

48-
* Laravel / Lumen Frameworks - See the documentation in [this repository](https://github.com/andrey-helldar/env-sync-laravel).
49-
* Symfony Framework - See the documentation in [this repository](https://github.com/andrey-helldar/env-sync-symfony).
49+
* Laravel / Lumen Frameworks - See the documentation in [this repository](https://github.com/TheDragonCode/env-sync-laravel).
5050

5151
### Native using
5252

5353
To call a command in your application, you need to do the following:
5454

5555
```php
56-
use Helldar\EnvSync\Services\Syncer;
56+
use DragonCode\EnvSync\Services\Syncer;
5757

5858
protected function syncer(): Syncer
5959
{
@@ -72,7 +72,7 @@ protected function sync()
7272
If you want to define default values or specify which key values should be stored, you need to pass an array to the constructor of the `Config` class:
7373

7474
```php
75-
use Helldar\EnvSync\Services\Syncer;
75+
use DragonCode\EnvSync\Services\Syncer;
7676

7777
protected function syncer(): Syncer
7878
{
@@ -93,28 +93,18 @@ You can also suggest your implementation by sending a PR. We will be glad 😊
9393
This package is licensed under the [MIT License](LICENSE).
9494

9595

96-
[badge_build]: https://img.shields.io/github/workflow/status/andrey-helldar/env-sync/phpunit?style=flat-square
96+
[badge_build]: https://img.shields.io/github/workflow/status/TheDragonCode/env-sync/phpunit?style=flat-square
9797

98-
[badge_downloads]: https://img.shields.io/packagist/dt/andrey-helldar/env-sync.svg?style=flat-square
98+
[badge_downloads]: https://img.shields.io/packagist/dt/dragon-code/env-sync.svg?style=flat-square
9999

100-
[badge_license]: https://img.shields.io/packagist/l/andrey-helldar/env-sync.svg?style=flat-square
100+
[badge_license]: https://img.shields.io/packagist/l/dragon-code/env-sync.svg?style=flat-square
101101

102-
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/andrey-helldar/env-sync.svg?style=flat-square
103-
104-
[badge_quality]: https://img.shields.io/scrutinizer/g/andrey-helldar/env-sync.svg?style=flat-square
105-
106-
[badge_stable]: https://img.shields.io/github/v/release/andrey-helldar/env-sync?label=stable&style=flat-square
107-
108-
[badge_styleci]: https://styleci.io/repos/333111450/shield
102+
[badge_stable]: https://img.shields.io/github/v/release/TheDragonCode/env-sync?label=stable&style=flat-square
109103

110104
[badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square
111105

112-
[link_build]: https://github.com/andrey-helldar/env-sync/actions
106+
[link_build]: https://github.com/TheDragonCode/env-sync/actions
113107

114108
[link_license]: LICENSE
115109

116-
[link_packagist]: https://packagist.org/packages/andrey-helldar/env-sync
117-
118-
[link_scrutinizer]: https://scrutinizer-ci.com/g/andrey-helldar/env-sync/?branch=main
119-
120-
[link_styleci]: https://github.styleci.io/repos/333111450
110+
[link_packagist]: https://packagist.org/packages/dragon-code/env-sync

SECURITY.md

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

composer.json

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
{
2-
"name": "andrey-helldar/env-sync",
2+
"name": "dragon-code/env-sync",
33
"description": "Keeping your .env.example is up to date",
44
"type": "library",
55
"license": "MIT",
6-
"keywords": ["env", "dotenv", "environment", "sync", "laravel", "symfony", "yii", "yii2", "framework", "native"],
6+
"keywords": ["env", "dotenv", "environment", "sync", "laravel", "symfony", "yii", "yii2", "framework", "native", "dragon-code", "dragon", "andrey-helldar"],
77
"authors": [
88
{
99
"name": "Andrey Helldar",
1010
"email": "[email protected]"
1111
}
1212
],
1313
"support": {
14-
"issues": "https://github.com/andrey-helldar/env-sync/issues",
15-
"source": "https://github.com/andrey-helldar/env-sync"
14+
"issues": "https://github.com/TheDragonCode/env-sync/issues",
15+
"source": "https://github.com/TheDragonCode/env-sync"
1616
},
1717
"require": {
1818
"php": "^7.3|^8.0",
19-
"andrey-helldar/support": "^2.5|^3.0|^4.0",
19+
"dragon-code/support": "^5.0",
2020
"symfony/finder": "^4.0|^5.0"
2121
},
2222
"require-dev": {
2323
"mockery/mockery": "^1.3.1",
24-
"phpunit/phpunit": "^8.0|^9.0"
24+
"phpunit/phpunit": "^9.0"
2525
},
2626
"suggest": {
27-
"andrey-helldar/env-sync-laravel": "env-sync package adapter for Laravel framework",
28-
"andrey-helldar/env-sync-symfony": "env-sync package adapter for Symfony framework"
27+
"dragon-code/env-sync-laravel": "env-sync package adapter for Laravel framework"
2928
},
3029
"autoload": {
3130
"psr-4": {
32-
"Helldar\\EnvSync\\": "src"
31+
"DragonCode\\EnvSync\\": "src"
3332
}
3433
},
3534
"autoload-dev": {
@@ -42,13 +41,5 @@
4241
"sort-packages": true
4342
},
4443
"minimum-stability": "stable",
45-
"prefer-stable": true,
46-
"extra": {
47-
"thanks": [
48-
{
49-
"name": "andrey-helldar/support",
50-
"url": "https://github.com/andrey-helldar/support"
51-
}
52-
]
53-
}
44+
"prefer-stable": true
5445
}

src/Concerns/Makeable.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22

3-
namespace Helldar\EnvSync\Concerns;
4-
5-
use Helldar\EnvSync\Services\Compiler;
6-
use Helldar\EnvSync\Services\Finder;
7-
use Helldar\EnvSync\Services\Parser;
8-
use Helldar\EnvSync\Services\Stringify;
9-
use Helldar\EnvSync\Services\Syncer;
10-
use Helldar\EnvSync\Support\Config;
3+
namespace DragonCode\EnvSync\Concerns;
4+
5+
use DragonCode\EnvSync\Services\Compiler;
6+
use DragonCode\EnvSync\Services\Finder;
7+
use DragonCode\EnvSync\Services\Parser;
8+
use DragonCode\EnvSync\Services\Stringify;
9+
use DragonCode\EnvSync\Services\Syncer;
10+
use DragonCode\EnvSync\Support\Config;
1111
use Symfony\Component\Finder\Finder as SymfonyFinder;
1212

1313
trait Makeable

src/Services/Compiler.php

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
<?php
22

3-
namespace Helldar\EnvSync\Services;
3+
namespace DragonCode\EnvSync\Services;
44

5-
use Helldar\EnvSync\Support\Config;
6-
use Helldar\Support\Concerns\Makeable;
7-
use Helldar\Support\Facades\Helpers\Instance;
8-
use Helldar\Support\Facades\Helpers\Str;
5+
use DragonCode\EnvSync\Support\Config;
6+
use DragonCode\Support\Concerns\Makeable;
7+
use DragonCode\Support\Facades\Helpers\Instance;
8+
use DragonCode\Support\Facades\Helpers\OS;
9+
use DragonCode\Support\Facades\Helpers\Str;
910

10-
final class Compiler
11+
class Compiler
1112
{
1213
use Makeable;
1314

1415
protected $hides = ['CLIENT', 'HOOK', 'KEY', 'LOGIN', 'PASS', 'SECRET', 'TOKEN', 'USER'];
1516

16-
protected $separator = "\n";
17+
protected $unix_separator = "\n";
18+
19+
protected $windows_separator = "\r\n";
1720

1821
protected $stringify;
1922

@@ -43,7 +46,7 @@ public function get(): string
4346
}
4447

4548
/**
46-
* @param array|\Helldar\EnvSync\Support\Config $config
49+
* @param array|\DragonCode\EnvSync\Support\Config $config
4750
*
4851
* @return $this
4952
*/
@@ -80,15 +83,17 @@ protected function compile(): string
8083
{
8184
$result = '';
8285

86+
$separator = $this->getSeparator();
87+
8388
foreach ($this->items as $values) {
8489
foreach ($values as $key => $value) {
85-
$result .= "{$key}={$value}{$this->separator}";
90+
$result .= "{$key}={$value}{$separator}";
8691
}
8792

88-
$result .= $this->separator;
93+
$result .= $separator;
8994
}
9095

91-
return trim($result) . $this->separator;
96+
return trim($result) . $separator;
9297
}
9398

9499
protected function replace(string $key, $value)
@@ -126,4 +131,11 @@ protected function section(string $key): string
126131
{
127132
return Str::before($key, '_');
128133
}
134+
135+
protected function getSeparator(): string
136+
{
137+
return OS::isWindows()
138+
? $this->windows_separator
139+
: $this->unix_separator;
140+
}
129141
}

0 commit comments

Comments
 (0)