Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaguerre committed Jan 12, 2025
1 parent a255dc2 commit c5c812d
Show file tree
Hide file tree
Showing 150 changed files with 2,757 additions and 1,004 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
example/ export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
name: PHPSpec
strategy:
matrix:
php-version: ["8.1", "8.3"]
php-version: ["8.3"]
fail-fast: false
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"require-dev": {
"doctrine/dbal": "^3.0",
"friends-of-phpspec/phpspec-expect": "^4.0",
"open-telemetry/transport-grpc": "^1.0",
"open-telemetry/gen-otlp-protobuf": "^1.0",
"open-telemetry/transport-grpc": "^1.0",
"php-http/httplug": "^2.3",
"phpspec/phpspec": "^7.5",
"phpstan/phpstan": "^1.4",
"symfony/framework-bundle": "*",
"symfony/framework-bundle": "^7.1",
"symfony/http-client": "*",
"symfony/messenger": "*",
"symfony/monolog-bundle": "^3.7",
Expand Down Expand Up @@ -69,4 +69,4 @@
"dev-main": "1.0.x-dev"
}
}
}
}
34 changes: 0 additions & 34 deletions docs/logging/custom-keys.md

This file was deleted.

17 changes: 0 additions & 17 deletions docs/tracing/message-bodies.md

This file was deleted.

32 changes: 0 additions & 32 deletions docs/tracing/propagating-context.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/tracing/simple-trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@ class CurrentTime
public function __invoke(Request $request): Response
{
$ip = $request->getClientIp();

$span = $this->getTracer()->spanBuilder('http')
->setSpanKind(SpanKind::KIND_CLIENT)
->setAttribute('net.peer.name', 'worldtimeapi.org')
->startSpan();
$info = $this->httpClient->request('GET', 'http://worldtimeapi.org/api/ip/' . $ip)->toArray();
$span->end();

$span = $this->getTracer()->spanBuilder('process')->startSpan();
$result = sprintf('Current time is %s in timezone "%s".', $info['datetime'], $info['timezone']);
Expand Down
37 changes: 0 additions & 37 deletions docs/tracing/static-usage.md

This file was deleted.

19 changes: 0 additions & 19 deletions docs/tracing/upstream-request-id.md

This file was deleted.

36 changes: 36 additions & 0 deletions example/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=
###< symfony/framework-bundle ###

###> symfony/messenger ###
# Choose one of the transports below
MESSENGER_TRANSPORT_DSN=amqp://guest:guest@rabbitmq:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:!ChangeMe!@postgresql:5432/app?serverVersion=16&charset=utf8"
###< doctrine/doctrine-bundle ###
11 changes: 11 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
symfony.lock
composer.lock
###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###
21 changes: 21 additions & 0 deletions example/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_dir(dirname(__DIR__).'/vendor')) {
throw new LogicException('Dependencies are missing. Try running "composer install".');
}

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
92 changes: 92 additions & 0 deletions example/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/dbal": "^3",
"doctrine/doctrine-bundle": "^2.13",
"doctrine/doctrine-fixtures-bundle": "^4.0",
"doctrine/orm": "^3.3",
"open-telemetry/exporter-otlp": "^1.2",
"phpdocumentor/reflection-docblock": "^5.6",
"phpstan/phpdoc-parser": "^2.0",
"symfony/amqp-messenger": "7.3.*",
"symfony/console": "7.3.*",
"symfony/dotenv": "7.3.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "7.3.*",
"symfony/http-client": "*",
"symfony/messenger": "7.3.*",
"symfony/monolog-bundle": "^3.10",
"symfony/property-access": "7.3.*",
"symfony/property-info": "7.3.*",
"symfony/runtime": "7.3.*",
"symfony/serializer": "7.3.*",
"symfony/yaml": "7.3.*",
"worldia/instrumentation-bundle": "^1.0@dev"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true,
"tbachert/spi": false
},
"bump-after-update": true,
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.3.*"
}
},
"repositories": [
{
"type": "path",
"url": "../",
"options": {
"symlink": true
}
}
]
}
14 changes: 14 additions & 0 deletions example/config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/*
* This file is part of the worldia/instrumentation-bundle package.
* (c) Worldia <developers@worldia.com>
*/

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Instrumentation\InstrumentationBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
];
14 changes: 14 additions & 0 deletions example/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
doctrine:
dbal:
url: "%env(resolve:DATABASE_URL)%"
use_savepoints: true
orm:
identity_generation_preferences:
Doctrine\DBAL\Platforms\PostgreSQLPlatform: identity
mappings:
App:
type: attribute
is_bundle: false
dir: "%kernel.project_dir%/src/Doctrine/Entity"
prefix: 'App\Doctrine\Entity'
alias: App
Loading

0 comments on commit c5c812d

Please sign in to comment.