drago-ex / project
The basis for new projects on Drago Extension.
Requires
- php: >=8.3 <9
- drago-ex/bootstrap: ^1.0
- drago-ex/project-docker: ^1.0
- drago-ex/project-front: ^1.0
- drago-ex/translator: ^2.0.0
- latte/latte: ^3.1
- nette/assets: ^1.0
- nette/robot-loader: ^4.1
- tracy/tracy: ^2.11
Requires (Dev)
- phpstan/phpstan-nette: ^1.2.9
README
Basis for new modules projects on Drago Extension
Requirements
- PHP >= 8.3
- Nette Framework
- Composer
- Docker
- Node.js
- Bootstrap
- Naja
Installation
composer create-project drago-ex/project
Basic information
Basic package for applications where the basis for Bootstrap, Vite, Docker, Naja is already prepared.
You can find all commands in package.json like running Docker or Vite.
Basic Naja scripts
-
ErrorsHandler - Handles Naja AJAX errors by displaying user-friendly alert messages based on HTTP status codes. Shows a dismissible Bootstrap alert in the page element with ID
snippet--message. -
HyperlinkDisable - Temporarily disables links with the
data-link-disableattribute during Naja requests to prevent multiple clicks. Re-enables the links once the request is complete. -
Spinner - Displays a full-page spinner during active Naja AJAX requests. Shows the spinner when a request starts and hides it once all requests are complete.
Available Extensions
Expand the base package with these ready-to-use modules:
Package Setup Orchestrator
The project includes a specialized tool to automate the initialization of all installed packages. It scans all packages in your vendor directory and collects custom setup commands defined in their composer.json.
Usage
Run the orchestrator (inside your Docker container if applicable):
docker compose exec server php bin/package-setup
Interactions:
- Select specific tasks by number (e.g.,
1,3). - Run everything sequentially by entering
a. - Quit by entering
q.
How to integrate your package
Add the drago-project section to the extra part of your package's composer.json:
{
"extra": {
"drago-project": {
"priority": 10,
"commands": {
"db:migrate-example": "php vendor/bin/migration db:migrate vendor/vendor-name/package-name/migrations",
"gen:example-class": "php vendor/bin/create-example"
}
}
}
}
Command Configuration (commands)
A key-value list where the key is the display name and the value is the shell command.
db:prefix: Used for database migrations. These are automatically grouped at the top of the list.gen:prefix: Used for code generation tasks.gen:*-permission: Specialized prefix for generating base AccessControl permission classes required by thedrago-ex/permissioncomponent.
Execution Priority (priority)
Controls the order in which commands are listed and executed when running all (a).
- Lower numbers run earlier (higher priority).
- Priority 10: Recommended for core packages (Auth, Users).
- Priority 20+: Recommended for dependent packages (Permissions, Commerce).
- Default 100: Used if no priority is specified.
Features
- Intelligent Sorting: Database migrations are prioritized and grouped together.
- Auto-Initialization: Detects if the migration system needs initial setup and offers one-click initialization.
- Robustness: If the database is unreachable, the tool skips DB tasks but still allows other setup commands to run.