codyas / skeleton-bundle
Codyas skeleton for Symfony apps development
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=8.3
- kevinpapst/tabler-bundle: ^1.4
- knplabs/knp-paginator-bundle: ^5.0 || ^6.0
- stof/doctrine-extensions-bundle: ^1.0
- symfony/flex: ^1.0 || ^2.0
- symfony/form: ^6.4 || ^7.0
- symfony/framework-bundle: ^6.4 || ^7.0
- symfony/http-client: ^6.4 || ^7.0
- symfony/orm-pack: ^1.0 || ^2.0
- symfony/security-bundle: ^6.4 || ^7.0
- symfony/stimulus-bundle: ^2.0
- symfony/translation: ^6.4 || ^7.0
- symfony/twig-bundle: ^6.4 || ^7.0
- symfony/ux-turbo: ^2.0
- symfony/ux-twig-component: ^2.0
- symfony/validator: ^6.4 || ^7.0
- symfony/webpack-encore-bundle: ^1.0 || ^2.0
- symfonycasts/reset-password-bundle: ^1.21
- symfonycasts/verify-email-bundle: ^1.17
- twig/twig: ^2.12|^3.0
README
Skeleton project installation
For Codyas team members, express installation method is available. CD to the folder you want to locate the project and execute the following command, make sure to replace PROJECT_NAME for your actual project name:
curl -s https://gist.githubusercontent.com/leoantunez/0446c79dcc717de4fbbc0cb8214c26d9/raw | bash -s PROJECT_NAME
Manual installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
composer require codyas/skeleton-bundle
Configuration
Security
1. The base user class
The bundle provides a base class with common structure Codyas\Skeleton\Model\UserModel
. The UserModel
class
already assumes email as primary identification and includes the following fields, so you don't need to implement them:
- id
- enabled
- password
- roles
- isVerified
If your user class requires another behaviour feel free to implement your own structure but make sure to implement the
UserModelInterface
2. Implementing the user class
Create an entity that will represent your users and extend the Codyas\Skeleton\Model\UserModel
class.
<?php namespace App\Entity; use App\Repository\UserRepository; use Codyas\Skeleton\Model\UserModel; use Codyas\Skeleton\Model\UserModelInterface; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: UserRepository::class)] class User extends UserModel implements UserModelInterface { }
Add any other fields in your class (if needed) and once done you are ready to sync the changes with your database.
3. Security configuration
Go to config/packages/security.yaml
and adjust the file with the following changes
security: providers: app_user_provider: entity: class: App\Entity\User property: email firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: lazy: true provider: app_user_provider custom_authenticator: App\Security\EmailAuthenticator #form_login: # login_path: app_login # check_path: app_login # enable_csrf: true logout: path: app_logout target: app_login access_control: - { path: ^/login, roles: PUBLIC_ACCESS } - { path: ^/, roles: ROLE_ADMIN }
The App\Security\EmailAuthenticator
class is automatically created when installing the bundle, but you can adjust it
to your needs or create a custom authenticator and modify the security configuration.