You've already forked dolibarr-api-bundle
initial version
This commit is contained in:
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
vendor/
|
||||
36
composer.json
Normal file
36
composer.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "magdev/dolibarr-api-bundle",
|
||||
"description": "Symfony bundle for Dolibarr ERP API client",
|
||||
"type": "symfony-bundle",
|
||||
"minimum-stability": "stable",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "magdev",
|
||||
"email": "magdev3.0@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"magdev/dolibarr-api": "dev-main",
|
||||
"symfony/dependency-injection": "^7.3",
|
||||
"symfony/config": "^7.3",
|
||||
"symfony/yaml": "^7.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/framework-bundle": "^7.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Magdev\\DolibarrApiBundle\\": "src/"
|
||||
}
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "path",
|
||||
"url": "/home/magdev/workspaces/php/dolibarr-api",
|
||||
"options": {
|
||||
"symlink": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
2240
composer.lock
generated
Normal file
2240
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
0
src/.gitignore
vendored
Normal file
0
src/.gitignore
vendored
Normal file
37
src/DependencyInjection/Configuration.php
Normal file
37
src/DependencyInjection/Configuration.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magdev\DolibarrApiBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
/**
|
||||
* @author Marco Grätsch <magdev3.0@gmail.com>
|
||||
*/
|
||||
final class Configuration implements ConfigurationInterface
|
||||
{
|
||||
public function getConfigTreeBuilder(): TreeBuilder
|
||||
{
|
||||
$treeBuilder = new TreeBuilder(name: 'magdev_dolibarr_api');
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
$rootNode->children()
|
||||
->scalarNode(name: 'baseUri')
|
||||
->isRequired()
|
||||
->cannotBeEmpty()
|
||||
->example(example: 'http://localhost')
|
||||
->end()
|
||||
->scalarNode(name: 'token')
|
||||
->isRequired()
|
||||
->cannotBeEmpty()
|
||||
->example(example: 'your-secret-api-token')
|
||||
->end()
|
||||
->booleanNode(name: 'verifyHttps')
|
||||
->defaultTrue()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
||||
36
src/DependencyInjection/MagdevDolibarrApiExtension.php
Normal file
36
src/DependencyInjection/MagdevDolibarrApiExtension.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magdev\DolibarrApiBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\Extension;
|
||||
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
|
||||
|
||||
/**
|
||||
* @author Marco Grätsch <magdev3.0@gmail.com>
|
||||
*/
|
||||
final class MagdevDolibarrApiExtension extends Extension
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container): void
|
||||
{
|
||||
$config = $this->processConfiguration(configuration: new Configuration(), configs: $configs);
|
||||
|
||||
if (isset($config['baseUri'])) {
|
||||
$container->setParameter(name: 'magdev.dolibarr_api.base_uri', value: $config['baseUri']);
|
||||
}
|
||||
if (isset($config['token'])) {
|
||||
$container->setParameter(name: 'magdev.dolibarr_api.token', value: $config['token']);
|
||||
}
|
||||
if (isset($config['verifyHttps'])) {
|
||||
$container->setParameter(name: 'magdev.dolibarr_api.verify_https', value: $config['verifyHttps']);
|
||||
}
|
||||
|
||||
$loader = new YamlFileLoader(
|
||||
container: $container,
|
||||
locator: new FileLocator(paths: __DIR__.'/../Resources/config')
|
||||
);
|
||||
$loader->load(resource: 'services.yaml');
|
||||
}
|
||||
}
|
||||
14
src/MagdevDolibarrApiBundle.php
Normal file
14
src/MagdevDolibarrApiBundle.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magdev\DolibarrApiBundle;
|
||||
|
||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||
|
||||
/**
|
||||
* @author Marco Grätsch <magdev3.0@gmail.com>
|
||||
*/
|
||||
final class MagdevDolibarrApiBundle extends Bundle
|
||||
{
|
||||
|
||||
}
|
||||
3
src/Resources/config/services.yaml
Normal file
3
src/Resources/config/services.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
services:
|
||||
Magdev\DolibarrApi\DolibarrApiClient:
|
||||
arguments: [null, '%magdev.dolibarr_api.base_uri%', '%magdev.dolibarr_api.token%', '%magdev.dolibarr_api.verify_https%']
|
||||
Reference in New Issue
Block a user