klucznik / cog-framework
PHP framework built on Symfony components
Requires
- php: >=8.3
- ext-dom: *
- ext-json: *
- ext-libxml: *
- ext-mbstring: *
- ext-mysqli: *
- ext-simplexml: *
- nesbot/carbon: ^3.0
- psr/simple-cache: ^3.0
- psy/psysh: ^v0.12.24
- robmorgan/phinx: ^0.16.12
- symfony/cache: ^7.4||^8.0
- symfony/config: ^7.4||^8.0
- symfony/console: ^7.4||^8.0
- symfony/dependency-injection: ^7.4||^8.0
- symfony/error-handler: ^7.4||^8.0
- symfony/event-dispatcher: ^7.4||^8.0
- symfony/filesystem: ^7.4||^8.0
- symfony/http-foundation: ^7.4||^8.0
- symfony/http-kernel: ^7.4||^8.0
- symfony/mime: ^7.4||^8.0
- symfony/routing: ^7.4||^8.0
- symfony/stopwatch: ^7.4||^8.0
- symfony/string: ^7.4||^8.0
- symfony/translation: ^7.4||^8.0
- symfony/yaml: ^7.4||^8.0
Requires (Dev)
- phpunit/phpunit: ^13.2.6
- vlucas/phpdotenv: ^5.6
README
A PHP framework built on Symfony components, with a database code generator that produces typed model classes from an existing MySQL schema.
Requirements
- PHP 8.3 or newer
- Extensions:
mbstring,json,dom,libxml,mysqli,simplexml
Installation
composer require klucznik/cog-framework
Bootstrapping
The framework is initialized once per request through Cog\BaseApplication::initialize().
The repository ships a working example of this wiring:
prepend.inc.php— loads the Composer autoloader and initializes the applicationpublic/index.php— main web entry pointcog— the console command
These are reference examples, not files you install. Copy them into your own project and adjust the paths to your Composer autoloader.
Cog\BaseApplication is meant to be extended, you should create your own Application class with your own modifications / customizations.
Code generation
The generator reads a codegen.xml configuration file describing the database
connection and output paths. Copy codegen.xml-dist to
codegen.xml, fill in your settings, then run:
./cog db:codegen
Testing
The suite runs against a MySQL fixture database. Load it once:
mysql -u root -p < src/Test/cog_test.sql
Connection details come from the COG_TEST_DB_* environment variables; override
the defaults in phpunit.xml.dist by copying it to
phpunit.xml (git-ignored). Then:
composer test
The bootstrap runs the code generator against that database before any test
executes, into the git-ignored .phpunit.codegen/ build directory, and registers
an autoloader for the resulting Generated\ and App\ classes. TestCodegen
runs first and reports any generation failure; the rest of the suite can rely on
the generated ORM layer being present.
License
MIT — see LICENSE.