Skip to content
Snippets Groups Projects
Commit e08aea9e authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Add a new "core" bundle which other bundles can depend on.

This is meant to for sharing code between the main app and the bundles
parents
No related branches found
No related tags found
No related merge requests found
/vendor
/composer.lock
\ No newline at end of file
# API-Core-Bundle
Contains things required by all bundles
\ No newline at end of file
{
"name": "dbp/api-core-bundle",
"type": "symfony-bundle",
"license": "AGPL-3.0-or-later",
"require": {
"php": "^7.2.24",
"api-platform/core": "^2.4",
"symfony/framework-bundle": "^4.1.12"
},
"require-dev": {
"symfony/phpunit-bridge": "^4.4",
"vimeo/psalm": "^3.12",
"phpstan/phpstan": "^0.12.33",
"phpstan/phpstan-phpunit": "^0.12.13"
},
"autoload": {
"psr-4": {
"DBP\\API\\CoreBundle\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"DBP\\API\\CoreBundle\\Tests\\": "tests/"
}
},
"config": {
"sort-packages": true,
"platform": {
"php": "7.2.24"
}
},
"scripts": {
"test": [
"@php vendor/bin/simple-phpunit"
],
"phpstan": [
"@php vendor/bin/phpstan analyze --ansi"
],
"psalm": [
"@php vendor/bin/psalm"
],
"lint": [
"@composer run phpstan",
"@composer run psalm"
]
}
}
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
parameters:
inferPrivatePropertyTypeFromConstructor: true
level: 3
paths:
- src
- tests
bootstrapFiles:
- vendor/bin/.phpunit/phpunit-8-0/vendor/autoload.php
excludes_analyse:
- tests/bootstrap.php
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="KERNEL_CLASS" value="App\Kernel" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="8" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
<directory>tests</directory>
</whitelist>
</filter>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
</phpunit>
<?xml version="1.0"?>
<psalm
totallyTyped="false"
errorLevel="5"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
<?php
namespace DBP\API\CoreBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class DbpCoreBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
}
}
\ No newline at end of file
<?php
namespace DBP\API\CoreBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('dbp_core');
return $treeBuilder;
}
}
\ No newline at end of file
<?php
namespace DBP\API\CoreBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
class DbpCoreExtension extends ConfigurableExtension
{
public function loadInternal(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader(
$container,
new FileLocator(__DIR__.'/../Resources/config')
);
$loader->load('services.yaml');
}
}
\ No newline at end of file
services:
\ No newline at end of file
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
require dirname(__DIR__).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment