Skip to content

Commit 8ef3db2

Browse files
authored
Merge pull request #16 from kaushikindianic/2531-envoi-integrate
perf: envoi integrate #2531
2 parents 36036d5 + 3a4b4f1 commit 8ef3db2

4 files changed

Lines changed: 28 additions & 7 deletions

File tree

.env.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
USERBASE_CLIENT_URL:
2+
description: userbase client connection. Either use a full DSN or a plain URL for the UserBase Authentication API endpoint
3+
type: url
4+
example: https://username@password@userbase.example.com
5+
required: true

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ The `examples/` directory contains a few example scripts that you can use during
3434

3535
First, copy the `.env.dist` file to `.env`. Edit the contents to match your Userbase server and credentials.
3636

37+
```bash
38+
cp .env.dist .env e
39+
edit .env # Edit configuration, database settings etc
40+
./vendor/bin/envoi validate # Run command validate based on meta file .env.yaml
41+
```
42+
3743
Then you can simply execute the examples like this:
3844

3945
php examples/checkcredentials.php alice sshhh

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,20 @@
99
"name": "Joost Faassen",
1010
"email": "j.faassen@linkorb.com",
1111
"role": "Development"
12+
},
13+
{
14+
"name": "kaushik prajapati",
15+
"email": "prajapatikaushik@gmail.com",
16+
"role": "Developer"
1217
}
1318
],
1419
"require": {
1520
"php": ">=5.3.0",
1621
"linkorb/userbase-role-contracts": "^1.0",
1722
"symfony/security": "~2.6 || ~3.0 || ^4",
1823
"psr/cache": "~1.0",
19-
"symfony/cache": "~3.0 || ^4"
24+
"symfony/cache": "~3.0 || ^4",
25+
"linkorb/envoi": "^1.1"
2026
},
2127
"require-dev": {
2228
"symfony/dotenv": "~3.0 || ^4"

examples/common.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@
22

33
require_once __DIR__.'/../vendor/autoload.php';
44

5-
use UserBase\Client\Client;
5+
use Envoi\Envoi;
66
use Symfony\Component\Dotenv\Dotenv;
7+
use UserBase\Client\Client;
8+
79

8-
$dotenv = new Dotenv();
9-
$dotenv->load(__DIR__.'/../.env');
10+
// .env validate
11+
$envFilename = __DIR__.'/../.env';
12+
$envMetaFile = __DIR__.'/../.env.yaml';
13+
Envoi::init($envFilename, $envMetaFile);
1014

1115
$url = getenv('USERBASE_CLIENT_URL');
12-
$username = getenv('USERBASE_CLIENT_USERNAME');
13-
$password = getenv('USERBASE_CLIENT_PASSWORD');
16+
//$username = getenv('USERBASE_CLIENT_USERNAME');
17+
//$password = getenv('USERBASE_CLIENT_PASSWORD');
1418

1519
if (!$url) {
1620
echo "Environment variables not yet properly configured\n";
1721
exit();
1822
}
1923

20-
$client = new Client($url, $username, $password);
24+
$client = new Client($url);

0 commit comments

Comments
 (0)