|
| 1 | +# NewsletterBundle |
| 2 | + |
| 3 | +## About |
| 4 | + |
| 5 | +This project is an **application bundle** for Symfony, designed to be intrinsically integrated into an existing application. It revolves around a newsletter management system, enabling the efficient dispatch of information and announcements to subscribed users. |
| 6 | + |
| 7 | +## Configuration |
| 8 | + |
| 9 | +### Installation |
| 10 | + |
| 11 | +Clone the repository into your Symfony project: |
| 12 | + |
| 13 | +```shell |
| 14 | +git clone https://github.com/mikael-fourre/NewsletterBundle |
| 15 | +``` |
| 16 | + |
| 17 | +Ensure the bundle is registered in your `config/bundles.php` file: |
| 18 | + |
| 19 | +```php |
| 20 | +return [ |
| 21 | + // ... |
| 22 | + App\Bundle\NewsletterBundle\NewsletterBundle::class => ['all' => true], |
| 23 | +]; |
| 24 | +``` |
| 25 | + |
| 26 | +### Routing Configuration |
| 27 | + |
| 28 | +Add the bundle's routes to your routing configuration. |
| 29 | + |
| 30 | +```yaml |
| 31 | +# config/routes.yaml |
| 32 | + |
| 33 | +newsletter_bundle: |
| 34 | + resource: '@NewsletterBundle/config/routes.yaml' |
| 35 | +``` |
| 36 | +
|
| 37 | +The routes provided by the bundle are: |
| 38 | +
|
| 39 | +- `newsletter_subscribe`: Handles newsletter subscriptions |
| 40 | +- `newsletter_confirm`: Manages subscription confirmations |
| 41 | +- `newsletter_unsubscribe`: Manages unsubscriptions |
| 42 | +- `newsletter_send`: Sends newsletters to all subscribed users (admin access only) |
| 43 | + |
| 44 | +### Template Configuration |
| 45 | + |
| 46 | +Configure the template paths by adjusting your `twig.yaml` file to recognize the NewsletterBundle's templates. |
| 47 | + |
| 48 | +```yaml |
| 49 | +# config/packages/twig.yaml |
| 50 | +
|
| 51 | +twig: |
| 52 | + paths: |
| 53 | + '%kernel.project_dir%/src/Bundle/NewsletterBundle/templates': NewsletterBundle |
| 54 | +``` |
| 55 | + |
| 56 | +### Parameters Configuration |
| 57 | + |
| 58 | +Define custom parameters in your services.yaml file to configure the contact email address. |
| 59 | + |
| 60 | +```yaml |
| 61 | +# config/services.yaml |
| 62 | +
|
| 63 | +parameters: |
| 64 | + contact_email: contact@domain.fr |
| 65 | +``` |
| 66 | + |
| 67 | +### Security Configuration |
| 68 | + |
| 69 | +Secure the administration route by adjusting your `security.yaml` file. |
| 70 | + |
| 71 | +```yaml |
| 72 | +# config/packages/security.yaml |
| 73 | +
|
| 74 | +security: |
| 75 | + access_control: |
| 76 | + - { path: ^/admin, roles: ROLE_ADMIN } |
| 77 | +``` |
| 78 | + |
| 79 | +## Usage |
| 80 | + |
| 81 | +- **Subscription**: Send a POST request to `/newsletter/subscribe` |
| 82 | +- **Confirmation**: Redirect users to `/newsletter/confirm` |
| 83 | +- **Unsubscription**: Use `/newsletter/unsubscribe` for unsubscriptions |
| 84 | +- **Newsletter Sending** (admin only): A POST request to `/admin/newsletter/send` sends newsletters |
| 85 | + |
| 86 | +## Contributing |
| 87 | + |
| 88 | +Contributions are always welcome! To contribute: |
| 89 | + |
| 90 | +- Fork the project |
| 91 | +- Create a branch for your modifications |
| 92 | +- Submit a Pull Request |
| 93 | + |
| 94 | +## Support |
| 95 | + |
| 96 | +Should you encounter issues or have questions, feel free to open an issue on GitHub. |
| 97 | + |
| 98 | +## License |
| 99 | + |
| 100 | +This project is licensed under the terms of the [MIT License](LICENSE). For more information, please refer to the file. |
0 commit comments