Skip to content

Commit

Permalink
support laravel 12 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarsn authored Mar 3, 2025
1 parent 1b0a8a5 commit f373efa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
php: [ 8.2, 8.3, 8.4 ]
laravel: [ ^11.0 ]
laravel: [ ^11.0, ^12.0 ]
name: PHP=${{ matrix.php }} LARAVEL=${{ matrix.laravel }}
runs-on: ubuntu-latest
env:
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
"require": {
"php": "^8.2",
"guzzlehttp/guzzle": "^7.5",
"illuminate/contracts": "^11.0",
"illuminate/http": "^11.0",
"illuminate/support": "^11.0",
"illuminate/contracts": "^11.0|^12.0",
"illuminate/http": "^11.0|^12.0",
"illuminate/support": "^11.0|^12.0",
"nesbot/carbon": "^2.13|^3.0"
},
"require-dev": {
"larastan/larastan": "^2.4",
"larastan/larastan": "^2.4|^3.0",
"laravel/pint": "^1.21",
"orchestra/testbench": "^9.0",
"phpunit/phpunit": "^10.0"
"orchestra/testbench": "^9.0|^10.0",
"phpunit/phpunit": "^10.0|^11.5"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Support/Facades/TmsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @method static ClientContract client(string $name)
* @method static ClientContract nullClient()
* @method static ClientContract createClient(string $name, AuthMethodContract $auth)
* @method static array getClients()
* @method static array<string, ClientContract> getClients()
*/
class TmsApi extends Facade
{
Expand Down
15 changes: 9 additions & 6 deletions src/TmsApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,20 @@ public function client(string $name): ClientContract
throw new InvalidTmsApiClientException('TMS Api client auth credentials are not provided.');
}

$basicAuth = new BasicAuthMethod($clientConfig['auth']['username'], $clientConfig['auth']['password']);
$clientUsername = Config::string('tms-api.clients.'.$name.'.auth.username');
$clientPassword = Config::string('tms-api.clients.'.$name.'.auth.password');

$basicAuth = new BasicAuthMethod($clientUsername, $clientPassword);

$this->clients[$name] = $this->makeClient($basicAuth);

if (isset($clientConfig['http'])) {
if (isset($clientConfig['http']['timeout'])) {
$this->clients[$name]->timeout((int) $clientConfig['http']['timeout']);
if (Arr::has($clientConfig, 'http')) {
if (Arr::has($clientConfig, 'http.timeout')) {
$this->clients[$name]->timeout(Config::integer('tms-api.clients.'.$name.'.http.timeout'));
}

if (isset($clientConfig['http']['connect_timeout'])) {
$this->clients[$name]->connectTimeout((int) $clientConfig['http']['connect_timeout']);
if (Arr::has($clientConfig, 'http.connect_timeout')) {
$this->clients[$name]->connectTimeout(Config::integer('tms-api.clients.'.$name.'.http.connect_timeout'));
}
}
}
Expand Down

0 comments on commit f373efa

Please sign in to comment.