Skip to content

Commit 31acc60

Browse files
committed
change example configuration so it works from a composer install
1 parent b00f503 commit 31acc60

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ vendor/
22
.php_cs.cache
33
.idea
44
composer.lock
5+
.hf-api-client-secrets.php

example/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

example/articleGroups.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
foreach ($autoloadFiles as $autoloadFile) {
1616
if (file_exists($autoloadFile)) {
17+
chdir(dirname($autoloadFile) . '/..');
1718
require_once $autoloadFile;
1819
}
1920
}
@@ -22,10 +23,8 @@
2223
use HF\ApiClient\Options\Options;
2324
use Zend\Cache\StorageFactory;
2425

25-
if (! file_exists(__DIR__ . '/conf.php')) {
26-
print 'copy example/conf.php.dist to example/conf.php';
27-
28-
die();
26+
if (! file_exists('.hf-api-client-secrets.php')) {
27+
die('copy example/.hf-api-client-secrets.php.dist to APP_ROOT/.hf-api-client-secrets.php');
2928
}
3029

3130
// optional but will then use filesystem default tmp directory
@@ -39,7 +38,7 @@
3938
'plugins' => ['serializer'],
4039
]);
4140

42-
$options = Options::fromArray(include(__DIR__ . '/conf.php'));
41+
$options = Options::fromArray(include('.hf-api-client-secrets.php'));
4342

4443
$api = ApiClient::createClient($options, $cache);
4544

example/practicesPos.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@
1010
__DIR__ . '/vendor/autoload.php',
1111
];
1212

13-
chdir(__DIR__ . '/..');
14-
1513
foreach ($autoloadFiles as $autoloadFile) {
1614
if (file_exists($autoloadFile)) {
15+
chdir(dirname($autoloadFile) . '/..');
1716
require_once $autoloadFile;
1817
}
1918
}
2019

20+
2121
use HF\ApiClient\ApiClient;
2222
use HF\ApiClient\Options\Options;
2323
use Zend\Cache\StorageFactory;
2424

25-
if (! file_exists(__DIR__ . '/conf.php')) {
26-
print 'copy example/conf.php.dist to example/conf.php';
27-
28-
die();
25+
if (! file_exists('.hf-api-client-secrets.php')) {
26+
die('copy example/.hf-api-client-secrets.php.dist to APP_ROOT/.hf-api-client-secrets.php');
2927
}
3028

3129
// optional but will then use filesystem default tmp directory
@@ -39,7 +37,7 @@
3937
'plugins' => ['serializer'],
4038
]);
4139

42-
$options = Options::fromArray(include(__DIR__ . '/conf.php'));
40+
$options = Options::fromArray(include('.hf-api-client-secrets.php'));
4341

4442
$api = ApiClient::createClient($options, $cache);
4543

0 commit comments

Comments
 (0)