tivins / framework
There is no license information available for the latest version (dev-main) of this package.
PHP Framework for web applications
dev-main
2022-03-16 22:12 UTC
Requires
- php: >=8.1
- ext-readline: *
- erusev/parsedown: ^1.7
- tivins/database: dev-main
- tivins/php-common: dev-main
Requires (Dev)
- phpunit/phpunit: ^9.5.10
This package is auto-updated.
Last update: 2024-10-17 03:30:55 UTC
README
PHP framework for web applications
Requirements:
- PHP8.0+
Dependencies:
- tivins/database (facultative. Only if a database is used for the project)
- erusev/parsedown
Usage
-
Install
composer require tivins/framework
-
Prepare folders
mkdir -p settings # create folder for settings files cp vendor/tivins/framework/references/reference.settings.php settings/my-app.test.settings.php # See settings echo "settings/" >> .gitignore # do not commit settings files mkdir -p htdocs/cache # public data and its cache dir mkdir -p pdata/cache # private data and its cache dir touch boot.php # see Boot touch htdocs/index.php # see Index
-
Init settings
mkdir settings # create folder for settings files touch settings/my-app.test.settings.php
Nota: Colons
:
are replaced by hyphens-
in the host name (eg: if the hostname ismy-app.test:8080
, the settings filename should bemy-app.test-8080.settings.php
.Here is an example of the setting file:
<?php use Tivins\Framework\App; use Tivins\Database\Connectors\MySQLConnector; App::initDB(new MySQLConnector( dbname: "my_database", user: "db_user", password: "password", ));
Nota: you can add a
common.settings.php
for shared rules (called first). -
Boot
<?php use Tivins\Framework\App; require __dir__ . '/vendor/autoload.php'; define('FRAMEWORK_ROOT_PATH', __dir__); App::init();
-
Index
<?php use Tivins\Framework\App; require __dir__ . '/../boot.php'; App::doc()->deliver();
Fresh install
{ "minimum-stability": "dev", "require": { "tivins/framework": "dev-main" }, "autoload": { "psr-4": { } } }
composer u echo "vendor/" >> .gitignore echo "composer.lock" >> .gitignore