Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Event Bindings

> **Related interfaces:**
> - [HasEventBindings](/packages/event/interfaces/has-event-bindings) — The interface you implement
> - [ActionBindingStrategy](/packages/event/interfaces/action-binding-strategy) — Executes the bindings
> - [Event](/packages/event/interfaces/event) — Creating event classes

## What are Event Bindings?

Event bindings are like adapters that connect your application's events to a platform's native event system. Think of
Expand Down Expand Up @@ -229,4 +234,18 @@ Remember:
- Document platform events clearly
- Use service classes for complex transformations

With event bindings, your application can easily "speak" to any platform while keeping its own code clean and portable.
With event bindings, your application can easily "speak" to any platform while keeping its own code clean and portable.

---

## Related Documentation

### Event Package Interfaces
- [HasEventBindings](/packages/event/interfaces/has-event-bindings) — Detailed interface documentation
- [ActionBindingStrategy](/packages/event/interfaces/action-binding-strategy) — How bindings are executed
- [Event](/packages/event/interfaces/event) — Creating event classes that bindings produce

### Related Guides
- [Event Listeners](event-listeners) — Handling events once they're bound
- [Event Package Overview](/packages/event/introduction) — Full event system documentation
- [Best Practices](/packages/event/patterns/best-practices) — Transformer patterns, testing strategies
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Event Listeners in PHPNomad

> **Related interfaces:**
> - [HasListeners](/packages/event/interfaces/has-listeners) — Declaring which events to listen for
> - [CanHandle](/packages/event/interfaces/can-handle) — Creating handler classes
> - [Event](/packages/event/interfaces/event) — Creating event classes

Event listeners are like friendly observers in your code that wait for specific things to happen, and then spring into
action when they do. Think of them as helpful assistants who are always ready to respond when something important occurs
in your application.
Expand Down Expand Up @@ -250,4 +255,20 @@ maintain but also easier to test and modify. Each listener can focus on its spec
any services it needs.

Think of event listeners as specialized workers in your application - each one has access to exactly the tools they
need (through dependency injection) and knows exactly what to do when certain events occur.
need (through dependency injection) and knows exactly what to do when certain events occur.

---

## Related Documentation

### Event Package Interfaces
- [HasListeners](/packages/event/interfaces/has-listeners) — Detailed interface documentation for declaring listeners
- [CanHandle](/packages/event/interfaces/can-handle) — Creating handler classes with dependency injection
- [Event](/packages/event/interfaces/event) — Creating event classes
- [EventStrategy](/packages/event/interfaces/event-strategy) — Broadcasting events programmatically

### Related Guides
- [Event Bindings](event-binding) — Connecting platform events to your application
- [Event Package Overview](/packages/event/introduction) — Full event system documentation
- [Best Practices](/packages/event/patterns/best-practices) — Handler patterns, testing strategies, anti-patterns
- [Logger Package](/packages/logger/introduction) — LoggerStrategy interface used in handler examples
10 changes: 9 additions & 1 deletion public/docs/core-concepts/bootstrapping/initializers/facades.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,12 @@ Consider alternatives when:

Remember: Facades in PHPNomad combine the singleton pattern with static access to provide convenient, globally
accessible services while maintaining the flexibility to work across different platforms. The key is to use them
thoughtfully and always remember to include the `WithInstance` trait.
thoughtfully and always remember to include the `WithInstance` trait.

---

## Related Documentation

- [Singleton Package](/packages/singleton/introduction) — WithInstance trait used by all facades
- [Logger Package](/packages/logger/introduction) — LoggerStrategy interface shown in examples
- [Event Package](/packages/event/introduction) — EventStrategy interface for event facades
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ Now that you have built your first datastore, explore these topics to deepen you
- **[Query Building](../packages/database/query-building)** — Build complex queries with conditions
- **[Junction Tables](../packages/database/junction-tables)** — Implement many-to-many relationships
- **[Advanced Patterns](../advanced/advanced-patterns)** — Soft deletes, audit trails, and optimization
- **[Logger Package](../packages/logger/introduction)** — LoggerStrategy interface for handler logging

---

Expand Down
6 changes: 6 additions & 0 deletions public/docs/packages/database/caching-and-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,12 @@ public function save(Model $item): Model {

---

## Related Documentation

* [Event Package](/packages/event/introduction) — Core event interfaces (`Event`, `EventStrategy`, `CanHandle`)
* [Event Listeners](/core-concepts/bootstrapping/initializers/event-listeners) — Setting up event listeners in initializers
* [Event Bindings](/core-concepts/bootstrapping/initializers/event-binding) — Binding platform events to application events

## What's Next

* [Database Handlers](/packages/database/handlers/introduction) — handlers that use caching and events
Expand Down
2 changes: 2 additions & 0 deletions public/docs/packages/database/database-service-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,5 @@ $serviceProvider->getQueryBuilder() // Doesn't exist
* [Database Handlers](/packages/database/handlers/introduction) — handlers that use the provider
* [Query Building](/packages/database/query-building) — using QueryBuilder and ClauseBuilder
* [Caching and Events](/packages/database/caching-and-events) — using CacheableService and EventStrategy
* [Logger Package](/packages/logger/introduction) — LoggerStrategy interface documentation
* [Event Package](/packages/event/introduction) — EventStrategy interface documentation
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,4 @@ Business logic belongs in services, not handlers.
* [Database Handlers Introduction](/packages/database/handlers/introduction) — overview of handler architecture
* [Query Building](/packages/database/query-building) — building custom queries
* [Caching and Events](/packages/database/caching-and-events) — customizing cache and event behavior
* [Logger Package](/packages/logger/introduction) — LoggerStrategy interface for error logging
4 changes: 3 additions & 1 deletion public/docs/packages/database/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ see_also:
- handlers/introduction
- tables/introduction
- table-schema-definition
- ../logger/introduction
noindex: false
---

Expand Down Expand Up @@ -410,7 +411,8 @@ If your data comes from REST APIs, GraphQL, or other non-database sources, you d

- **[phpnomad/datastore](../datastore/introduction)** — Defines interfaces that database handlers implement
- **phpnomad/models** — Provides DataModel interface (covered in [Models and Identity](../../core-concepts/models-and-identity))
- **phpnomad/events** — EventStrategy interface for broadcasting events
- **[phpnomad/event](../event/introduction)** — EventStrategy interface for broadcasting events
- **[phpnomad/logger](../logger/introduction)** — LoggerStrategy interface for operation logging
Comment on lines +414 to +415
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove or fix links to non-existent event/logger docs

These new cross-references point to ../event/introduction and ../logger/introduction, but there are no corresponding directories under public/docs/packages/ in this repo (no packages/event or packages/logger). As-is, the generated docs will render links that 404. If the new package docs live elsewhere, these URLs need to match their actual location or be omitted until those pages exist.

Useful? React with 👍 / 👎.


---

Expand Down
1 change: 1 addition & 0 deletions public/docs/packages/datastore/traits/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,4 @@ To understand how handlers work and what they're responsible for, see:
- [Core Implementation](/packages/datastore/core-implementation) — when to use traits vs manual implementation
- [Database Handlers](/packages/database/handlers/introduction) — the handler side of the delegation contract
- [Datastore Interfaces](/packages/datastore/interfaces/introduction) — the public contracts these traits implement
- [Logger Package](/packages/logger/introduction) — LoggerStrategy for logging in decorators
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,4 @@ Most handlers extend this interface with additional capabilities (e.g., `Datasto
* [Datastore Interface](/packages/datastore/interfaces/datastore) — the interface this trait implements
* [WithDatastorePrimaryKeyDecorator](/packages/datastore/traits/with-datastore-primary-key-decorator) — adds `find()` method
* [Core Implementation](/packages/datastore/core-implementation) — when to use traits vs manual implementation
* [Logger Package](/packages/logger/introduction) — LoggerStrategy interface used in examples above
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,4 @@ This ensures the handler supports primary key lookups.
* [DatastoreHasPrimaryKey Interface](/packages/datastore/interfaces/datastore-has-primary-key) — the interface this trait implements
* [WithDatastoreWhereDecorator](/packages/datastore/traits/with-datastore-where-decorator) — adds query-builder methods
* [Database Handlers](/packages/database/handlers/introduction) — the handler side of the contract
* [Logger Package](/packages/logger/introduction) — LoggerStrategy interface used in examples above
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,4 @@ This ensures the handler supports query-builder operations.
* [DatastoreHasWhere Interface](/packages/datastore/interfaces/datastore-has-where) — the interface this trait implements
* [WithDatastorePrimaryKeyDecorator](/packages/datastore/traits/with-datastore-primary-key-decorator) — adds `find()` method
* [Query Building](/packages/database/query-building) — how handlers implement query builders
* [Logger Package](/packages/logger/introduction) — LoggerStrategy interface used in examples above
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# EventInterceptor

> **See also:** [Event Package](/packages/event/introduction) for the core `Event` and `EventStrategy` interfaces.

The `EventInterceptor` is a built-in interceptor in PHPNomad designed for **publishing events** after a controller has
completed its work. It lets you broadcast domain events in response to API calls, keeping controllers free of
side-effect logic.
Expand Down
9 changes: 8 additions & 1 deletion public/docs/packages/rest/interceptors/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,11 @@ confusion and unintended side effects.
* Use interceptors to **enforce cross-cutting policies** (envelopes, headers, serialization), not domain logic.
* Be explicit about **which interceptors run where**—avoid magical or hidden behaviors.

Following these practices ensures interceptors stay predictable, reusable, and maintainable over time.
Following these practices ensures interceptors stay predictable, reusable, and maintainable over time.

---

## Related Documentation

- [Logger Package](../../logger/introduction.md) - LoggerStrategy interface used for request logging
- [Included Interceptors](./included-interceptors/introduction.md) - Pre-built interceptors in PHPNomad