Skip to content

Commit ee84863

Browse files
authored
[Docs] Rework Sylius resource introduction (#298)
Fixes #297
2 parents b0f5fbf + a5396ec commit ee84863

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

docs/resource/index.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
# SyliusResourceBundle
22

3-
There are plenty of things you need to handle for every single Resource in your web application.
3+
The **Sylius Resource Bundle** provides a powerful and extensible foundation for exposing your **business resources** (entities, aggregates, etc.) in a declarative way.
4+
Rather than generating controllers or relying on rigid admin generators, it offers a flexible architecture that lets you focus on your domain model while the bundle handles the boilerplate.
45

5-
Several "Admin Generators" are available for Symfony, but we needed something really simple, that will allow us to have reusable controllers
6-
but preserve the performance and standard Symfony workflow. We did not want to generate any code or write "Admin" class definitions in PHP.
7-
The big goal was to have exactly the same workflow as with writing controllers manually but without actually creating them!
6+
A *Resource* is any business object you want to expose — for example, a `Product`, `Order`, or `UserProfile`.
87

9-
Another idea was not to limit ourselves to a single persistence backend.
10-
``Resource`` component provides us with generic purpose persistence services and you can use this bundle with multiple persistence backends.
11-
So far we support:
8+
Each resource can define a set of **operations** — actions that can be performed on it.
9+
Typical operations include `index`, `show`, `create`, `update`, and `delete`, but you can also define custom, domain-specific operations too.
10+
The bundle orchestrates each operation through a well-defined lifecycle involving **providers**, **processors**, and **responders**:
1211

13-
* Doctrine ORM
14-
* Doctrine MongoDB ODM
15-
* Doctrine PHPCR ODM
12+
- **Providers** are responsible for loading or creating the resource object and **validating it** (ensuring the object is consistent before any business logic is applied).
13+
- Example: load from Doctrine, create a new instance, hydrate from request data, validate the object, or fetch from an external API.
14+
- **Processors** handle the business logic or persistence layer (e.g. saving, executing domain services, dispatching events).
15+
- **Responders** produce the final response (e.g. rendering a template).
16+
17+
This architecture allows you to use the bundle in two main ways:
18+
19+
- **Rapid Application Mode (RAD)** – perfect for quick CRUD setup with Doctrine ORM. You define your entity, mark it as a resource, and everything just works.
20+
- **Domain-Driven Design / Advanced Mode** – where you control how data is provided and processed by writing your own providers and processors.
21+
22+
In short, the Sylius Resource Bundle is both **declarative** and **extensible** — define your resources and their operations, and let the framework handle the rest, while still giving you full control over the domain logic when you need it.
1623

1724
## Resource system for Symfony applications.
1825

0 commit comments

Comments
 (0)