experteam / api-base-bundle
Base functionality bundle for APIs
Package info
github.com/experteam-mx/api-base-bundle
Type:symfony-bundle
pkg:composer/experteam/api-base-bundle
Requires
- php: >=8.2
- ext-bcmath: *
- ext-json: *
- ext-pdo: *
- ext-redis: *
- doctrine/dbal: ^3
- doctrine/doctrine-bundle: ^2.13
- doctrine/doctrine-fixtures-bundle: ^4.0
- doctrine/orm: ^3.3
- friendsofsymfony/rest-bundle: ^3.8
- nelmio/api-doc-bundle: ^4.36
- php-di/phpdoc-reader: ^2.2
- symfony/config: 7.4.*
- symfony/dependency-injection: 7.4.*
- symfony/http-client: 7.4.*
- symfony/http-kernel: 7.4.*
- symfony/security-bundle: 7.4.*
- symfony/security-core: 7.4.*
- symfony/serializer: 7.4.*
- symfony/uid: 7.4.*
- symfony/validator: 7.4.*
Requires (Dev)
- phpunit/phpunit: ^11.5
- symfony/dotenv: 7.4.*
- symfony/flex: ^2
- symfony/framework-bundle: 7.4.*
- symfony/mailer: 7.4.*
- symfony/phpunit-bridge: 7.4.*
Suggests
- symfony/mailer: Sends the Supervisor FATAL alert by SMTP instead of the API Services email route
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 5.0.2
- 5.0.1
- 5.0.0
- 4.3.5
- 4.3.4
- 4.3.3
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.0
- 3.5.10
- 3.5.9
- 3.5.8
- 3.5.7
- 3.5.6
- 3.5.5
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.8
- 3.4.7
- 3.4.6
- 3.4.5
- 3.4.4
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.1.24
- 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1.0.0
This package is auto-updated.
Last update: 2026-11-27 14:39:20 UTC
README
Base Services for APIs in Symfony 5.1+
It includes:
- Params Client: Service to obtain the value of parameters defined in api-companies.
- JSend Response: Sets the format of the JSON response according to the JSEND specification (https://github.com/omniti-labs/jsend).
- Request Util: Request validation service.
Install
- Run de following composer command:
composer require experteam/api-base-bundle
-
Create the configuration file through any of the following options:
a. Manually copy the example file in the package root to the folder
config/packages/.
b. Copy thevendor_copy.phpfile to the root of the project and configure the scripts in thecomposer.jsonfile:"scripts": { "vendor-scripts": [ "@php vendor_copy.php -s vendor/experteam/api-base-bundle/experteam_api_base.yaml.example -d config/packages/experteam_api_base.yaml --not-overwrite --ignore-no-source" ], "post-install-cmd": [ "@vendor-scripts" ], "post-update-cmd": [ "@vendor-scripts" ] }, -
Edit the bundle configuration file
config/packages/experteam_api_base.yaml:
experteam_api_base:
params:
remote:
enabled: [Enabled]
url: [URL]
defaults:
[PARAM NAME]: [Value]
[PARAM NAME]: [Value]
Update
Run de following composer command:
composer update experteam/api-base-bundle
Supervisor FATAL alert
experteam:supervisor:fatal-alert is a Supervisor event listener. When a worker reaches FATAL it emails support and logs the event to ELK. A rejected or unreachable email is logged too.
The email goes by Symfony Mailer when the API has it, and otherwise through the API Services email route. Either way it retries once on a transport error. Configure the sender for Mailer, or the route and its key for API Services:
experteam_api_base:
supervisor_alert:
sender_address: '%env(MAILER_FROM_ADDRESS)%'
sender_name: '%env(MAILER_FROM_NAME)%'
experteam_api_base:
supervisor_alert:
remote_url: '%env(APIS_SERVICES_URL)%/emails'
app_key: '%env(AUTH_MASTER_APP_KEY)%'
Add the listener in the same change that requires this version. Without the command the listener never starts: it ends in FATAL, or respawns without end when PHP takes longer than startsecs to fail. Register it in deploy/supervisor, with its logs in the /var/log/supervisord.log.d pod volume so they survive a container restart:
[eventlistener:supervisor_fatal_alert]
command=php -d display_errors=stderr /opt/app-root/src/bin/console experteam:supervisor:fatal-alert --no-interaction
events=PROCESS_STATE_FATAL
buffer_size=50
autostart=true
autorestart=true
startsecs=1
startretries=35
stderr_logfile=/var/log/supervisord.log.d/supervisor_fatal_alert.err.log
stdout_logfile=/var/log/supervisord.log.d/supervisor_fatal_alert.out.log
The listener's stdout carries the Supervisor protocol, so nothing else in the process may write to it. A stray line makes Supervisor stop sending events while the process keeps running.
The email points support to /var/log/supervisord.log.d/supervisor_<program>.err.log, so name each worker's stderr_logfile after its program.
It reads the recipient from SUPERVISOR_FATAL_ALERT_EMAIL, crasupport@experteam.com.ec when it is not set, and the namespace from MY_POD_NAMESPACE, which the deployment template sets from metadata.namespace. The pod name is the container host name. Run it with --test to send a test email.
The email is the HTML template in src/Resources/supervisor-fatal-alert.html, with the DHL colors and every value escaped. It uses Poppins where the mail client loads web fonts and Arial in Outlook.
The email tells support that OpenShift restarts the container on its own, which holds only when the deployment has the liveness probe that fails while a Supervisor program is FATAL.