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

This package is auto-updated.

Last update: 2024-05-17 02:40:55 UTC


README

PHP framework for web applications

Requirements:

  • PHP8.0+

Dependencies:

Usage

  1. Install

    composer require tivins/framework
  2. 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
  3. 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 is my-app.test:8080, the settings filename should be my-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).

  4. Boot

    <?php
    use Tivins\Framework\App;
    require __dir__ . '/vendor/autoload.php';
    define('FRAMEWORK_ROOT_PATH', __dir__);
    App::init();
  5. 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