Initial version of CloudObjectsServiceProvider

This commit is contained in:
2024-09-17 21:59:36 +02:00
parent bbbe56161b
commit 39dbf9ec6b
3 changed files with 43 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/vendor/

14
composer.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "cloudobjects/laravel-sdk",
"description" : "CloudObjects SDK for Laravel Applications.",
"type": "library",
"license": "MPL-2.0",
"require": {
"cloudobjects/sdk" : "*"
},
"autoload": {
"psr-4" : {
"CloudObjects\\SDK\\Laravel\\" : "src"
}
}
}

View File

@@ -0,0 +1,28 @@
<?php
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
namespace CloudObjects\SDK\Laravel;
use Illuminate\Support\ServiceProvider;
use CloudObjects\SDK\ObjectRetriever;
use CloudObjects\SDK\WebAPI\APIClientFactory;
class CloudObjectsServiceProvider extends ServiceProvider {
public function boot() {
// nothing to do here
}
public function register() {
$this->app->bind(ObjectRetriever::class, function() {
return new ObjectRetriever($this->app['config']->get('cloudobjects.core'));
});
$this->app->bind(APIClientFactory::class, function() {
return new APIClientFactory(app(ObjectRetriever::class));
});
}
}