drago-ex / project
The basis for new projects on Drago Extension.
Requires
- php: >=8.3 <9
- drago-ex/bootstrap: ^2.0
- drago-ex/project-docker: ^1.0
- drago-ex/project-front: ^3.0
- latte/latte: ^3.1
- nette/assets: ^1.0
- nette/robot-loader: ^4.1
- tracy/tracy: ^2.11
Requires (Dev)
- drago-ex/project-tools: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-nette: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Base project for Nette applications with Drago Extension: Bootstrap, Naja, Vite and Docker prepared, extended by ready-made feature packages.
Requirements
- PHP >= 8.3, < 9
- Composer
- Node.js
- Docker
Installation
composer create-project drago-ex/project
npm install npm run vite:build npm run docker:dev
docker:dev starts the server on http://127.0.0.1:8080 and keeps copying your changes into the container.
All commands (Docker, Vite) are in package.json.
Application Structure
app/Corecontains shared infrastructure and application services.app/Presentationcontains presenters, templates and feature modules.app/Presentation/Accessorycontains reusable presentation helpers and Latte widgets.assets/contains the entry points of Vite and the basic Naja extensions.local/holds the configuration of this environment that stays out of git, e.g. the database connection inlocal/db.neon.
Naja Extensions
- ErrorsHandler shows an alert with the HTTP error of a failed request in the element
snippet--message. - HyperlinkDisable disables links with
data-link-disablewhile a request runs. - Spinner shows a full-page spinner while requests run (needs
naja/spinner.scss).
assets/core/base.js registers ErrorsHandler; register the others where you use them, e.g.
registerNajaExtensions(HyperlinkDisable, Spinner) in an entry point.
Feature Packages
Each package contains the base of one feature. Project Tools copies
its files into the project on composer require, where they become your own code to adapt. A later
composer update does not overwrite them; vendor/bin/drago-diff shows what changed in a package.
Infrastructure:
- Docker Database: MariaDB in Docker and the connection.
- Docker: the PHP server image (installed with the project).
Website and users:
- Front: the front module (installed with the project).
- Front UI: the website layout and home page.
- User: the signed-in user in presenters and templates.
- Authentication: sign-in, sign-up and password recovery.
- Account: the user's own account settings.
Administration:
- Backend: the administration module.
- Backend UI: the administration layout and menu.
- Settings: website name, description and other settings.
- Permissions: users, roles and their permissions.
Content:
- Blog: articles, categories and comments.
- Static Pages: pages with their own URL and menu item.
- Gallery: images for the content of articles and pages.
- Commerce: e-shop administration.
Project Preset installs the website and the administration with all of them except commerce, with assets ready for all packages.
Package Setup
After installing packages with a database, run the migrations:
docker compose exec -u www-data server php bin/project-setup
It runs the migrations of the installed packages and of the project's migrations/ (only new ones on the next
run). With project-auth and no administrator yet it asks for the administrator account, with project-settings and
no website name yet for the name and the description of the website.
After every composer install and composer update, bin/project-assets writes the ## Assets sections of
the installed packages into .drago-project/assets.md: the lines to add to assets/admin.js, admin.scss,
front.js and front.scss.