tdmsistemasweb/core-bundle

Symfony bundle with authentication, admin panel, reCAPTCHA, profile management and legal pages

Maintainers

Package info

github.com/tiagomellobr/core-bundle

Type:symfony-bundle

pkg:composer/tdmsistemasweb/core-bundle

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-27 22:23 UTC

This package is auto-updated.

Last update: 2026-05-27 22:36:20 UTC


README

Symfony bundle with full authentication, admin panel, reCAPTCHA v3, profile management, and legal pages — ready to install in any Symfony 7.4+ project.

What the bundle provides

  • Authentication — form login, logout, CSRF protection
  • User registration — with email verification (SymfonyCasts VerifyEmail)
  • Password reset — full email-based flow (SymfonyCasts ResetPassword)
  • Profile — edit name/email and change password
  • Admin panel — EasyAdmin 5 with user CRUD
  • reCAPTCHA v3 — protection on login, registration, and password reset
  • Legal pages — privacy policy and terms of use
  • CLI commandapp:create-user to create users from the terminal
  • Pre-configured security — firewall, provider, and access_control injected automatically via prependExtension

Requirements

  • PHP 8.2+
  • Symfony 7.4
  • PostgreSQL (or any other Doctrine-supported database)
  • Mailer configured (for sending verification and password reset emails)

Installation

Automatic installation (Symfony Flex recipe)

If you have added the custom recipe endpoint to your project's composer.json (see Flex Recipe below), all configuration is applied automatically:

composer require tdmsistemasweb/core-bundle

Flex will automatically:

  • Register the bundle in config/bundles.php
  • Create config/packages/reset_password.yaml
  • Create config/routes/tdmsistemasweb_core.yaml
  • Add environment variables to .env

Then just run the migrations:

php bin/console doctrine:migrations:migrate

Manual installation

If you are not using the Flex recipe, follow the steps below.

1. Install via Composer

composer require tdmsistemasweb/core-bundle

2. Register the bundle

In config/bundles.php:

return [
    // ... other bundles
    TdmSistemasWeb\CoreBundle\TdmSistemasWebCoreBundle::class => ['all' => true],
];

3. Import the routes

In config/routes.yaml:

tdmsistemasweb_core:
    resource: '@TdmSistemasWebCoreBundle/config/bundle_routes.yaml'

4. Configure the password reset repository

Create (or edit) config/packages/reset_password.yaml:

symfonycasts_reset_password:
    request_password_repository: TdmSistemasWeb\CoreBundle\Repository\ResetPasswordRequestRepository

5. Configure Doctrine entity mapping

In config/packages/doctrine.yaml, add the bundle's entity mapping inside orm.mappings:

doctrine:
    orm:
        mappings:
            TdmSistemasWebCoreBundle:
                type: attribute
                is_bundle: false
                dir: '%kernel.project_dir%/vendor/tdmsistemasweb/core-bundle/src/Entity'
                prefix: 'TdmSistemasWeb\CoreBundle\Entity'
                alias: TdmSistemasWebCoreBundle

Note: the bundle injects this mapping automatically via prependExtension. If you prefer not to rely on prepend, add it manually as shown above.

6. Register the bundle migrations

In config/packages/doctrine_migrations.yaml:

doctrine_migrations:
    migrations_paths:
        'TdmSistemasWeb\CoreBundle\Migrations': '%kernel.project_dir%/vendor/tdmsistemasweb/core-bundle/migrations'

7. Run the migrations

php bin/console doctrine:migrations:migrate

8. Configure environment variables

Add to your .env (or .env.local):

# Mailer — configure a real transport in production
MAILER_DSN=null://null

# Enable/disable public user registration via the web form
REGISTRATION_ENABLED=true

# reCAPTCHA v3 — get your keys at https://www.google.com/recaptcha/admin
RECAPTCHA_SITE_KEY=
RECAPTCHA_SECRET_KEY=

# Google Analytics 4 (optional, only used in production)
GOOGLE_ANALYTICS_ID=

Leave RECAPTCHA_SITE_KEY and RECAPTCHA_SECRET_KEY empty to disable reCAPTCHA validation in development.

Security

The bundle automatically configures the following via prependExtension:

  • Provider app_user_provider — loads users by email from TdmSistemasWeb\CoreBundle\Entity\User
  • Firewall main — form_login pointing to app_login, logout at app_logout
  • Access control — public routes (login, registration, reset, legal pages) and admin protected by ROLE_ADMIN

If you need to override any part of the security configuration, create config/packages/security.yaml in your project. Note: access_control is not mergeable — defining your own replaces the bundle's entirely.

Available routes

Name Method Path
app_home GET /
app_login GET/POST /login
app_logout GET /logout
app_register GET/POST /register
app_verify_email GET /verify/email
app_forgot_password_request GET/POST /reset-password
app_check_email GET /reset-password/check-email
app_reset_password GET/POST /reset-password/reset/{token}
app_profile GET/POST /profile
app_profile_password POST /profile/password
app_privacy_policy GET /politica-de-privacidade
app_terms_of_use GET /termos-de-uso
admin ANY /admin

Create a user via CLI

php bin/console app:create-user --name="John Doe" --email="john@example.com" --password="secret123"

# To create an admin user
php bin/console app:create-user --name="Admin" --email="admin@example.com" --password="secret123" --admin

Customising templates

The bundle's templates can be overridden by creating files at the same path inside your project's templates/ directory:

templates/
├── base.html.twig                      ← main layout
├── home/index.html.twig
├── security/login.html.twig
├── registration/register.html.twig
├── reset_password/request.html.twig
├── profile/edit.html.twig
└── legal/
    ├── privacy_policy.html.twig
    └── terms_of_use.html.twig

Local development (Docker)

The repository includes a full Docker environment for developing the bundle itself.

# Start all services
docker compose up -d

# Run migrations
docker compose exec php php bin/console doctrine:migrations:migrate

# Create an admin user
docker compose exec php php bin/console app:create-user --admin

# Access the application
open http://localhost:8080

# Mailpit (dev emails)
open http://localhost:8025

Flex Recipe

The recipe files live in the recipe/ directory of this repository, ready to be published to a dedicated tdmsistemasweb/recipes GitHub repository.

Publishing the recipe

  1. Create a new GitHub repository: tdmsistemasweb/recipes
  2. Copy the contents of the recipe/ directory to the root of that repository and push
  3. The repository structure should look like this:
index.json
tdmsistemasweb/
  core-bundle/
    1.0/
      manifest.json
      .env
      config/
        packages/
          reset_password.yaml
        routes/
          tdmsistemasweb_core.yaml

Using the recipe in a project

Add the custom endpoint to the project's composer.json before installing the bundle:

{
    "extra": {
        "symfony": {
            "endpoint": [
                "https://api.github.com/repos/tdmsistemasweb/recipes/contents/index.json",
                "flex://defaults"
            ]
        }
    }
}

Then install the bundle normally — Flex will apply the recipe automatically:

composer require tdmsistemasweb/core-bundle

What the recipe does

Action Detail
Registers the bundle Adds TdmSistemasWebCoreBundle to config/bundles.php
Config: reset password Creates config/packages/reset_password.yaml
Config: routes Creates config/routes/tdmsistemasweb_core.yaml
Env vars Appends REGISTRATION_ENABLED, RECAPTCHA_SITE_KEY, RECAPTCHA_SECRET_KEY, GOOGLE_ANALYTICS_ID to .env

Everything else (Doctrine entity mapping, migrations path, security firewall) is configured automatically by the bundle's prependExtension — no recipe files needed for those.

License

MIT