`src/` theo chức năng
Thư mục src/ là “core framework”, được autoload theo namespace DLight\ (xem composer.json).
Dưới đây là các thành phần hiện có trong repo, gom theo nhóm chức năng.
1) Application (HTTP + tiện ích ứng dụng)
- App core:
src/Application/App.php(boot web/cli, env, session, route run) - Router:
src/Application/Router.php(routing, group, middleware, named routes, API normalize) - Request:
src/Application/Request.php - Middleware runner:
src/Application/Middleware.php - Session:
src/Application/Session.php - View:
src/Application/View.php+src/Application/Interfaces/ViewEngine.php - View drives:
src/Application/Drive/View/BladeOneDrive.phpsrc/Application/Drive/View/BladeDrive.phpsrc/Application/Drive/View/TwigDrive.php
- Cache drives:
src/Application/Drive/Cache/Redis.phpsrc/Application/Drive/Cache/Memcached.php
- DB facade:
src/Application/DB.php - Mail:
src/Application/Mail.php - Log:
src/Application/Log.php - Validator:
src/Application/Validator.php - Hash:
src/Application/Hash.php - File/Resource:
src/Application/File.php,src/Application/Resource.php - WebSocket:
src/Application/WebSocket.php - Helpers:
src/Application/helper/helper.phpsrc/Application/helper/cli.phpsrc/Application/helper/source.phpsrc/Application/helper/TokenGenerator.phpsrc/Application/helper/default_pages.php
2) Database (adapter + builder + mapper)
- Database manager:
src/Database/DatabaseManager.php - Adapters:
src/Database/Adapter/MysqliAdapter.phpsrc/Database/Adapter/PdoMysqlAdapter.phpsrc/Database/Adapter/Sqlite3Adapter.phpsrc/Database/Adapter/PdoSqliteAdapter.php
- Query builders:
src/Database/QueryBuilder/BaseBuilder.phpsrc/Database/QueryBuilder/MysqlBuilder.phpsrc/Database/QueryBuilder/SqliteBuilder.php
- Mappers:
src/Database/Mapper/BaseMapper.phpsrc/Database/Mapper/MysqlMapper.phpsrc/Database/Mapper/SqliteMapper.php
- Interfaces:
src/Database/Interfaces/AdapterInterface.phpsrc/Database/Interfaces/BuilderInterface.phpsrc/Database/Interfaces/MapperInterface.php
- Traits:
src/Database/Traits/SoftDelete.phpsrc/Database/Traits/Timestamp.phpsrc/Database/Traits/Authenticatable.phpsrc/Database/Traits/Freeze.php
- Exceptions:
src/Database/Exception/UnsupportedDriverException.phpsrc/Database/Exception/UnsupportedDesignException.php
3) Command (CLI framework)
- Command core:
src/Application/Command.php - Command kernel:
src/Command/Core.php - Register commands:
src/Command/Register.php - Built-in commands:
src/Command/Server.php,src/Command/Setting.php,src/Command/Hint.php - Helper (I/O):
src/Command/Helper/ConsoleInput.phpsrc/Command/Helper/ConsoleOutput.phpsrc/Command/Helper/CommandEntry.php
4) Reports (error/exception handler + renderer)
- Report facade:
src/Reports/Report.php - Handler:
src/Reports/Handler.php - Renderers:
src/Reports/Render/Html.php,src/Reports/Render/Cli.php - Interfaces:
src/Reports/Interface/HandlerInterface.php,src/Reports/Interface/RenderInterface.php
5) Attribute (PHP 8 attributes)
- Route attribute:
src/Attribute/Route.php(dùng với Router scan attributes) - Viewer attribute:
src/Attribute/Viewer.php(post-process output của controller method)
6) Utils
- Sorting algorithms (demo):
src/Utils/Sorting/*.php - Gồm: Bubble, Quick, Merge, Heap, Insertion, Selection, Count, Radix, Tim, Shell, Bucket, ...
7) Kit
- Dump:
src/Kit/dump/var_dump.php - HTML helper:
src/Kit/helper/html_helper.php