sindla / aurora
Aurora - Symfony 7.2 bundle
Installs: 3 084
Dependents: 0
Suggesters: 1
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=8.3
- ext-bcmath: *
- ext-ctype: *
- ext-curl: *
- ext-iconv: *
- ext-intl: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- ext-pcre: *
- ext-session: *
- ext-simplexml: *
- ext-tokenizer: *
- ext-zend-opcache: *
- aws/aws-sdk-php: 3.*
- brick/math: 0.12.*
- doctrine/orm: ^3.3
- firebase/php-jwt: 6.*
- geoip2/geoip2: 3.1.*
- matthiasmullie/minify: 1.3.*
- scienta/doctrine-json-functions: 6.3.*
- symfony/uid: 7.2.*
- tedivm/jshrink: 1.7.*
Suggests
- sindla/aurora: no suggestions at this moment
- 7.2.x-dev
- v7.2.25
- v7.2.24
- v7.2.23
- v7.2.22
- v7.2.21
- v7.2.20
- v7.2.19
- v7.2.18
- v7.2.17
- v7.2.16
- v7.2.15
- v7.2.14
- v7.2.13
- v7.2.12
- v7.2.11
- v7.2.10
- v7.2.9
- v7.2.8
- v7.2.7
- v7.2.6
- v7.2.5
- v7.2.4
- v7.2.3
- v7.2.2
- v7.2.1
- v7.2.0
- 7.1.x-dev
- v7.1.6
- v7.1.5
- v7.1.4
- v7.1.3
- v7.1.2
- v7.1.1
- v7.1.0
- 7.0.x-dev
- v7.0.3
- v7.0.2
- v7.0.1
- v7.0.0
- 6.4.x-dev
- v6.4.0
- 6.3.x-dev
- v6.3.0
- 6.2.x-dev
- v6.2.0
- 6.1.x-dev
- v6.1.0
- 5.4.x-dev
- v5.4.5
- v5.4.4
- v5.4.3
- v5.4.2
- v5.4.1
- v5.4.0
- 5.3.x-dev
- v5.3.10
- v5.3.9
- v5.3.8
- v5.3.7
- v5.3.6
- v5.3.4
- v5.3.3
- v5.3.2
- v5.3.1
- v5.3.0
- 5.2.x-dev
- v5.2.53
- v5.2.52
- v5.2.51
- v5.2.50
- v5.2.49
- v5.2.48
- v5.2.47
- v5.2.45
- v5.2.44
- v5.2.43
- v5.2.42
- v5.2.41
- v5.2.40
- v5.2.37
- v5.2.36
- v5.2.35
- v5.2.34
- v5.2.32
- v5.2.29
- v5.2.28
- v5.2.26
- v5.2.25
- v5.2.24
- v5.2.23
- v5.2.22
- v5.2.21
- v5.2.20
- v5.2.19
- v5.2.18
- v5.2.17
- v5.2.16
- v5.2.15
- v5.2.14
- v5.2.13
- v5.2.12
- v5.2.11
- v5.2.10
- v5.2.9
- v5.2.7
- v5.2.6
- v5.2.5
- v5.2.4
- v5.2.3
- v5.2.2
- v5.2.1
- v5.2.0
- 5.1.x-dev
- v5.1.31
- v5.1.30
- v5.1.29
- v5.1.28
- v5.1.27
- v5.1.26
- v5.1.25
- v5.1.24
- v5.1.23
- v5.1.22
- v5.1.21
- v5.1.20
- v5.1.19
- v5.1.18
- v5.1.17
- v5.1.16
- v5.1.15
- v5.1.14
- v5.1.13
- v5.1.12
- v5.1.11
- v5.1.10
- v5.1.9
- v5.1.8
- v5.1.7
- v5.1.6
- v5.1.5
- v5.1.4
- v5.1.3
- v5.1.2
- v5.1.1
- v5.1.0
- 5.0.x-dev
- v5.0.30
- v5.0.29
- v5.0.28
- v5.0.27
- v5.0.26
- v5.0.25
- v5.0.24
- v5.0.23
- v5.0.22
- v5.0.21
- v5.0.20
- v5.0.19
- v5.0.18
- v5.0.17
- v5.0.16
- v5.0.15
- v5.0.14
- v5.0.13
- v5.0.12
- v5.0.11
- v5.0.10
- v5.0.9
- v5.0.8
- v5.0.7
- v5.0.6
- v5.0.5
- v5.0.4
- v5.0.3
- v5.0.2
- v5.0.1
- v5.0.0
- 4.4.x-dev
- v4.4.1
- v4.4.0
- 3.4.x-dev
- v3.4.3
- v3.4.2
- v3.4.1
- v3.4.0
This package is auto-updated.
Last update: 2025-02-27 14:46:17 UTC
README
Version | Unit testing | Latest Version | Last Commit | Required PHP |
---|---|---|---|---|
5.2 | >=7.4 | |||
5.3 | >=7.4 & >= 8.0 | |||
5.4 | >=7.4 & >= 8.0 | |||
6.1 | >= 8.1 | |||
6.2 | >= 8.2 | |||
6.3 | >= 8.2 | |||
7.0 | >= 8.2 | |||
7.1 | >= 8.3 | |||
7.2 | >= 8.3 |
Installation
The Aurora package is Packagist ready, and Composer can be used to install it.
composer require sindla/aurora:7.2.*
The x-dev flag can be used to install the development version:
composer require sindla/aurora:7.2.x-dev
Configuration
Even if Aurora is Packagist-ready and is a Symfony bundle, no recipe will be installed automatically.
🗂️ config/packages/aurora.yaml
- Create the file
config/packages/aurora.yaml
and add the following content:
parameters: aurora.bundle: 'App' aurora.root: '%kernel.project_dir%' aurora.tmp: '%kernel.project_dir%/var/tmp' aurora.resources: '%kernel.project_dir%/var/resources' aurora.static: '%kernel.project_dir%/public/static' aurora.locales: [ 'en', 'ro' ] aurora.locale: 'ro' # maxmind.com license key aurora.maxmind.license_key: '%env(default::MAXMIND_LICENSE_KEY)%' # Minify output aurora.minify.output: false aurora.minify.output.ignore.extensions: ['.pdf', '.csv', '.jpg', '.png', '.gif', '.doc', '.docx', '.xls', '.xlsm', '.xlsx', '.xml', '.zip'] aurora.minify.output.ignore.content.type: ['text/plain', 'text/csv', 'application/octet-stream', 'image/jpeg', 'image/png', 'image/gif', 'application/pdf', 'application/xml', 'application/zip'] # https://developers.google.com/web/fundamentals/web-app-manifest #aurora.pwa.version_append: "!php/eval `date('Y-m-d H')`" aurora.pwa.enabled: '%env(bool:AURORA_PWA_ENABLED)%' aurora.pwa.debug: '%env(bool:AURORA_PWA_DEBUG)%' aurora.pwa.version_append: "!php/eval `App\Utils::pwaVersioAppend()`" aurora.pwa.automatically_prompt: false aurora.pwa.app_name: '' aurora.pwa.app_short_name: '' aurora.pwa.app_description: '' aurora.pwa.start_url: '/?pwa' aurora.pwa.display: 'fullscreen' # fullscreen | standalone | minimal-ui aurora.pwa.icons: '%kernel.project_dir%/public/static/img/favicon' aurora.pwa.theme_color: '#2C3E50' # Sets the color of the tool bar, and may be reflected in the app's preview in task switchers aurora.pwa.background_color: '#2C3E50' # Should be the same color as the load page, to provide a smooth transition from the splash screen to your app aurora.pwa.offline: '/aurora/pwa-offline' aurora.pwa.precache: - '/' aurora.pwa.prevent_cache_header_request_accept: - 'text/html' - 'text/html; charset=UTF-8' - 'application/json' aurora.pwa.prevent_cache: - '/ajax-requests' - '/q' - '/xhr' - '/login' - '/logout' - '/admin' - '.*\.mp4' # mp4 files are large, some browsers will not be able to fully cache it, meaning the video will not be displayed - '.*\/match-this\/.*' aurora.pwa.external_cache: - 'fonts.gstatic.com' - 'fonts.googleapis.com' aurora.dns_prefetch: - 'www.google.com' - 'fonts.googleapis.com' - 'fonts.gstatic.com' - 'googletagmanager.com' - 'www.googletagmanager.com' - 'www.google-analytics.com' - 'google-analytics.com' - 'googleads.g.doubleclick.net' - 'www.googletagservices.com' - 'adservice.google.com' - 'adservice.google.ro' - 'www.facebook.com' - 'gstatic.com' - 'www.gstatic.com' - 'google.com' - 'google.ro' - 'connect.facebook.net' - 'youtube.com' - 'addthis.com' - 'gemius.pl' - 'pubmatic.com' - 'innovid.com' - 'everesttech.net' - 'quantserve.com' - 'rubiconproject.com' - 'facebook.com' - 'agkn.com' - 'casalemedia.com'
🗂️ config/packages/dev/aurora.yaml
- Create the file
config/packages/dev/aurora.yaml
and add the following content:
parameters: aurora.minify.output: false
🗂️ composer.json
- Edit
composer.json
and add the following content:
"post-install-cmd": [ "Sindla\\Bundle\\AuroraBundle\\Composer\\ScriptHandler::postInstall" ], "post-update-cmd": [ "Sindla\\Bundle\\AuroraBundle\\Composer\\ScriptHandler::postUpdate" ]
🗂️ config/packages/twig.yaml
- Edit
config/packages/twig.yaml
and add the following content:
twig: default_path: '%kernel.project_dir%/templates' debug: '%kernel.debug%' strict_variables: '%kernel.debug%' exception_controller: ~ paths: '%kernel.project_dir%/vendor/sindla/aurora/src/templates': Aurora globals: aurora: '@aurora.twig.utility'
🗂️ config/routes.yaml
- Will enable Aurora Black Hole, Favicons, Manifest & PWA (Progressive Web Application) controllers
- Edit
config/routes.yaml
and add the following content:
aurora: resource: "@AuroraBundle/Resources/config/routes/routes.yaml"
Then run composer update
to update and install the rest of the dependencies.
⚙️ Progressive Web Apps
- To use Progressive Web Apps (PWA), edit your Twig template and between
<head>
and</head>
add the following content:
{{ aurora.pwa(app.request) }}
⚙️ HTML Minifier
- To enable HTML Minifier edit
config/packages/aurora.yaml
and changeaurora.minify.output
totrue
, then editconfig/services.yaml
add the following content:
Sindla\Bundle\AuroraBundle\EventSubscriber\OutputSubscriber: arguments: $container: '@service_container' $utilityExtension: '@aurora.twig.utility' #$headers: #text/html: #Strict-Transport-Security: "max-age=1536000; includeSubDomains" #Content-Security-Policy: "default-src 'self'" # ?aurora.nonce? will be replace with uniq nonce. for twig, use {{ aurora.nonce() }} #Content-Security-Policy: "script-src 'nonce-?aurora.nonce?' 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https: http:; object-src 'none'" #Content-Security-Policy: "script-src 'self' 'unsafe-inline' 'unsafe-eval' https: http:; object-src 'none'" #Referrer-Policy: "no-referrer-when-downgrade" tags: - { name: kernel.event_listener, event: kernel.response }
⚙️ MaxMind GeoLite2Country & GeoLite2City
- When
composer install
and/orcomposer update
are used, Aurora will try to automatically download the MaxMind GeoLite2Country & GeoLite2City - To enable this, edit your
.env.local
and add the following content (you will need a MaxMind licence key):
MAXMIND_LICENSE_KEY=_CHANGE_THIS_WITH_YOUR_PRIVATE_LICENTE_KEY_ SINDLA_AURORA_GEO_LITE2_COUNTRY=true SINDLA_AURORA_GEO_LITE2_CITY=true SINDLA_AURORA_GEO_LITE2_ASN=true
- Edit
config/services.yaml
and add/append the following content:
services: _defaults: bind: $auroraClient: '@aurora.client'
- Or edit
config/services.yaml
and add the following code to inject the@aurora.client
only where it is needed:
services: App\Controller\TestController: arguments: $auroraClient: '@aurora.client'
- Edit your controller and add/append the following code:
<?php namespace App\Controller; use Sindla\Bundle\AuroraBundle\Utils\AuroraClient\Client; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\Cache; use Symfony\Component\Routing\Annotation\Route; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; #[Route('/test-controller')] final class TestController extends AbstractController { public function __construct( protected Client $auroraClient ) { } #[Route(path: '/client-ip-2-country', name: 'TestController:clientIp2Country', methods: ['OPTIONS', 'GET'])] #[Cache(maxage: 60, smaxage: 120, public: true, mustRevalidate: true)] public function clientIp2Country(Request $request): JsonResponse { return new JsonResponse([ 'countryCode' => $this->auroraClient->ip2CountryCode($this->auroraClient->ip($request)) ]); } }
Inject ContainerAwareInterface into Doctrine Migrations
config/services.yaml
... ################################################################################################################### ### Doctrine Migration ############################################################################################ ### Inject Container into migrations; also, check doctrine_migrations.yaml > Doctrine\Migrations\Version\MigrationFactory Doctrine\Migrations\Version\DbalMigrationFactory: ~ Sindla\Bundle\AuroraBundle\Doctrine\Migrations\Factory\MigrationFactoryDecorator: decorates: Doctrine\Migrations\Version\DbalMigrationFactory arguments: [ '@Sindla\Bundle\AuroraBundle\Doctrine\Migrations\Factory\MigrationFactoryDecorator.inner', '@service_container' ] ...
config/packages/doctrine_migrations.yaml
doctrine_migrations: services: 'Doctrine\Migrations\Version\MigrationFactory': 'Sindla\Bundle\AuroraBundle\Doctrine\Migrations\Factory\MigrationFactoryDecorator' ...
- For favicons, can use https://www.favicon-generator.org/