Overview of marko/queue-database
developmarko/queue-database is a database queue driver that stores and processes jobs within SQL tables. It is designed to be transaction-safe during polling and provides persistence for failed jobs.repository·develop·Indexed 18 days ago
https://github.com/marko-php/markoAn enterprise-grade, modular PHP 8.5+ framework designed for deep extensibility. Marko allows developers to override or intercept framework and third-party module components using preferences, plugins, and observers. The ecosystem includes packages for admin panels (supporting Latte and Twig), admin authentication and RBAC, REST API responses, and amphp async runtime integration via the Revolt event loop.
marko/queue-database is a database queue driver that stores and processes jobs within SQL tables. It is designed to be transaction-safe during polling and provides persistence for failed jobs.The marko/config package is designed for type-safe configuration management. Key features include:
database.host).getString, getInt).Marko Core serves as the foundation of the Marko ecosystem. It provides the following essential services for building extensible applications:
| Plugin | Description |
|---|---|$
| marko-skills | Scaffolding skills for generating modules, commands, services, and other Marko artefacts |
| marko-lsp | Marko-aware language server providing completions, diagnostics, and hover docs in editors |
| marko-mcp | Codebase introspection MCP server exposing module graph, routes, and config to AI agents |
The Marko documentation is organized into five distinct sections based on the developer's journey. Knowing which section to consult helps you find the right level of detail:
composer create-project to a finished, working application.The marko/framework metapackage requires PHP 8.5 or higher.
It includes the following core packages:
| Package | Description |
|---|---|
marko/core | Bootstrap, DI container, module loader, plugins, events |
marko/routing | Route attributes, router, middleware |
marko/cli | Command-line interface and console commands |
marko/errors | Error handling abstraction |
marko/errors-simple | Simple error handler for production |
marko/config | Configuration management with scoped values |
marko/hashing | Password hashing and verification |
marko/validation | Data validation with attribute-based rules |
The marko/devserver package provides a single CLI entry point to manage a full development stack. It automates the lifecycle of three main components:
It supports both detached mode (running in the background) and foreground mode (running in the terminal for active log monitoring).
A plugin is a class that intercepts the input or output of a public method on another class without replacing that class. It is Marko's fine-grained extensibility primitive. Plugins are automatically discovered from any module's src/ directory; no manual registration is required.
Use a plugin when you need to modify arguments to, or the result from, a public method on a class without rewriting or subclassing it. Common use cases include:
Note: If you need to perform a total replacement of a class, use a Preference instead. Plugins and Preferences are complementary: Plugins modify behavior, while Preferences swap entire implementations.
In Marko, a module is any Composer package that is recognized by the framework. To turn a standard Composer package into a Marko module, you must set the extra.marko.module flag to true in your composer.json file. This flag enables automatic discovery and wiring into the application without requiring manual service provider registration or kernel configuration.
At a minimum, a module requires:
name.autoload mapping.extra.marko.module: true configuration.{
"name": "app/blog",
"autoload": {
"psr-4": {
"App\\Blog\\": "src/"
}
},
"extra": {
"marko": {
"module": true
}
}
}Relationships are defined using property attributes on your Entity classes. Marko does not support lazy loading; all related entities must be loaded explicitly via eager loading.
/**
* HasOne: The foreignKey is the property name on the RELATED entity pointing back to this one.
*/
#[HasOne(entityClass: Profile::class, foreignKey: 'userId')]
public ?Profile $profile = null;
/**
* HasMany: The foreignKey is the property name on the RELATED entity pointing back to this one.
*/
#[HasMany(entityClass: Comment::class, foreignKey: 'postId')]
public EntityCollection $comments;
/**
* BelongsTo: The foreignKey is the property name on THIS entity pointing to the related entity.
*/
#[BelongsTo(entityClass: Post::class, foreignKey: 'postId')]
public ?Post $post = null;
/**
* BelongsToMany: Uses a pivot entity.
* foreignKey: pivot property pointing to THIS entity.
* relatedKey: pivot property pointing to the RELATED entity.
*/
#[BelongsToMany(
entityClass: Tag::class,
pivotClass: PostTag::class,
foreignKey: 'postId',
relatedKey: 'tagId',
)]
public EntityCollection $tags;The Marko Admin ecosystem consists of several specialized packages that work together to build a management interface:
marko/admin: Core admin functionality, including defining sections via #[AdminSection] and managing menu items with MenuItem.marko/admin-panel: Provides the UI framework, including the AdminMenuBuilder for permission-filtered navigation and the dashboard system using DashboardWidgetInterface.marko/admin-auth: Handles security, including authentication via GuardInterface, role/permission management, and protecting controllers with AdminAuthMiddleware or the #[RequiresPermission] attribute.marko/admin-api: Enables building administrative JSON endpoints using the ApiResponse class.Marko uses three distinct layers to provide context to AI agents. Choosing the right layer depends on what kind of help you are trying to provide.
description.| If you want to provide... | Use this layer |
|---|---|
| Factual code intel (completions, definitions, hover) | LSP feature |
| An action or non-trivial computation (search, validate, query) | MCP tool |
| A multi-step convention with judgment calls | Skill |
| A one-line, always-on rule | Per-package guidelines.md |