Skip to content

Commit 3c56b7d

Browse files
committed
Add documentation and license
1 parent 53e0b1c commit 3c56b7d

File tree

7 files changed

+96
-13
lines changed

7 files changed

+96
-13
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Jason Schilling
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,8 @@
77
[![codecov](https://codecov.io/gh/SoureCode/DoctrineExtensionBundle/branch/master/graph/badge.svg?token=GBFBVXQYK4)](https://codecov.io/gh/SoureCode/DoctrineExtensionBundle)
88
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FSoureCode%2FDoctrineExtensionBundle%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/SoureCode/DoctrineExtensionBundle/master)
99

10-
Enhances Doctrine with:
11-
12-
- **Timestampable**: Automatically manage creation/update timestamps. (`createdAt`, `updatedAt`)
13-
- **Blameable**: Track the user responsible for changes. (`createdBy`, `updatedBy`)
14-
- **UTC Date/Time**: Replaces all Doctrine datetime types with UTC-based types to ensure all date-related values are stored in UTC in the database.
15-
- **Translatable**: Provides a simple way to manage translations for your entities.
16-
17-
>
18-
> Why another implementation???
19-
>
20-
21-
It provides clean, focused support for UTC date handling and entity auditing without bloated overhead or complex computation.
22-
I focused on performance and simplicity, ensuring that the bundle is easy to use and understand.
10+
[Documentation](./docs/index.md)
11+
[License](./LICENSE)
2312

2413
## Installation
2514

docs/blameable.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# TBD

docs/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
# Getting Started
3+
4+
## Introduction
5+
6+
The Doctrine Extension Bundle enhances Doctrine ORM for Symfony applications by providing a set of powerful extensions.
7+
These include automatic timestamp and user tracking, seamless UTC date handling, and a simple yet robust translation system for your entities.
8+
Designed with performance and simplicity in mind, this bundle integrates easily into your project, helping you manage common entity behaviors with minimal configuration.
9+
10+
>
11+
> Why another implementation???
12+
>
13+
14+
It provides clean, focused support for UTC date handling and entity auditing without bloated overhead or complex computation.
15+
I focused on performance and simplicity, ensuring that the bundle is easy to use and understand.
16+
17+
## Features
18+
19+
- [**Timestampable**](./timestampable.md): Automatically manage creation and update timestamps for your entities.
20+
- [**Blameable**](./blameable.md): Track the user responsible for creating or updating an entity.
21+
- [**UTC Date/Time**](./utc-datetime.md): Ensures all date-related values are stored in UTC in the database.
22+
- [**Translatable**](./translatable.md): Provides a simple way to manage translations for your entities.

docs/timestampable.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
# Timestampable
3+
4+
The **Timestampable** extension automatically manages the creation and update timestamps for your entities.
5+
It adds two fields to your entity: `createdAt` and `updatedAt`.
6+
These fields are automatically populated when the entity is created or updated, respectively.
7+
8+
## Usage
9+
10+
To use the **Timestampable** extension, your target entity class must implement the `TimestampableInterface` and optionally use the `TimestampableTrait`.
11+
12+
```php
13+
namespace App\Entity;
14+
15+
use Doctrine\ORM\Mapping as ORM;
16+
use SoureCode\Bundle\DoctrineExtension\Contracts\TimestampableInterface;
17+
use SoureCode\Bundle\DoctrineExtension\Traits\TimestampableTrait;
18+
19+
#[ORM\Entity]
20+
class User implements TimestampableInterface {
21+
use TimestampableTrait;
22+
23+
#[ORM\Id]
24+
#[ORM\GeneratedValue]
25+
#[ORM\Column(type: 'integer')]
26+
private ?int $id = null;
27+
28+
public function getId(): ?int
29+
{
30+
return $this->id;
31+
}
32+
}
33+
```
34+
35+
After implementing the interface and using the trait do not forget to generate migrations and update the database schema.
36+
37+
```bash
38+
symfony console doctrine:migrations:diff
39+
```
40+
41+
or if you are using the maker bundle
42+
43+
```bash
44+
symfony console make:migration
45+
```

docs/translatable.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# TBD

docs/utc-datetime.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# TBD

0 commit comments

Comments
 (0)