Welcome to the DynamoPHP Symfony Bundle! This bundle integrates DynamoPHP into Symfony applications, allowing for seamless configuration and service registration. With this bundle, you can leverage the power of AWS DynamoDB in your Symfony projects.
- Easy Integration: Quickly integrate DynamoPHP with your Symfony application.
- Service Registration: Automatically register services for easier management.
- Strongly Typed: Benefit from type safety in your data models.
- Single Table Design: Optimize your database structure for performance.
- Data Mapper: Use a data mapper pattern for clean separation of concerns.
- NoSQL Support: Work seamlessly with NoSQL databases.
- ORM Capabilities: Take advantage of Object-Relational Mapping for easier data handling.
To install the DynamoPHP Symfony Bundle, follow these steps:
Install via Composer: Run the following command in your project directory:
composer require nonstophitler/dynamophp-symfony
Add Bundle to Kernel: Register the bundle in your
config/bundles.php
file:return [ // Other bundles... NonStopHitler\DynamoPHPBundle\DynamoPHPBundle::class => ['all' => true], ];
Configuration: After installation, configure the bundle in your
config/packages/dynamophp.yaml
file.
Once you have installed the bundle, you can start using it in your application.
To use the DynamoPHP service, you can inject it into your controllers or services:
use NonStopHitler\DynamoPHPBundle\Service\DynamoDBService;
class MyController extends AbstractController
{
private $dynamoDBService;
public function __construct(DynamoDBService $dynamoDBService)
{
$this->dynamoDBService = $dynamoDBService;
}
public function index()
{
$data = $this->dynamoDBService->getData('my_table', 'my_key');
return $this->json($data);
}
}
For more advanced scenarios, you can use the data mapper feature to handle complex data structures. Define your models and map them to your DynamoDB tables. This approach helps maintain a clean architecture and separates your business logic from data access.
You can configure the DynamoPHP Symfony Bundle by editing the config/packages/dynamophp.yaml
file. Here is an example configuration:
dynamo_php:
aws:
region: 'us-east-1'
version: 'latest'
credentials:
key: '%env(AWS_ACCESS_KEY_ID)%'
secret: '%env(AWS_SECRET_ACCESS_KEY)%'
table:
name: 'my_table'
primary_key: 'my_key'
Make sure to set the necessary environment variables in your .env
file:
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
We welcome contributions to the DynamoPHP Symfony Bundle! If you would like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your branch and create a pull request.
Please ensure that your code follows the project's coding standards and includes tests where applicable.
This project is licensed under the MIT License. See the LICENSE file for more details.
For support, please visit the Releases section. Here you can find the latest versions and download them for your project.
The DynamoPHP Symfony Bundle provides a robust solution for integrating AWS DynamoDB into your Symfony applications. With its easy setup, strong typing, and powerful features, you can streamline your data management processes. We hope you find this bundle useful for your projects. Happy coding!
For more information, please check the Releases section for updates and new features.