Slim Framework: Difference between revisions

From Rixort Wiki
Jump to navigation Jump to search
Line 5: Line 5:
== Installation ==
== Installation ==


Core:
== Core ==


  composer require slim/slim:"4.*"
  composer require slim/slim:"4.*"
  composer require slim/psr7
  composer require slim/psr7


Additional libraries:
== Additional libraries ==


  composer require filp/whoops
  composer require filp/whoops
Line 20: Line 20:
  composer require phpunit/phpunit --dev
  composer require phpunit/phpunit --dev


Directories:
== Directories ==


  mkdir public
  mkdir public
  mkdir src
  mkdir src


<code>.gitignore</code>:
== <code>.gitignore</code> ==


  vendor/
  vendor/


<code>composer.json</code> autoloader settings:
== <code>composer.json</code> autoloader ==


  "autoload": {
  "autoload": {
        "psr-4": {
    "psr-4": {
            "App\\": "src/"
        "App\\": "src/"
        }
    }
    },
},
    "autoload-dev": {
"autoload-dev": {
        "psr-4": {
    "psr-4": {
            "App\\Test\\": "tests/"
        "App\\Test\\": "tests/"
        }
    }
    }
}


== Links ==
== Links ==

Revision as of 14:38, 30 October 2021

Requirements

Slim 4 requires PHP 7.2 or greater. The current Ubuntu LTS and Debian stable include 7.4, so this requirement is satisfied on up to date servers.

Installation

Core

composer require slim/slim:"4.*"
composer require slim/psr7

Additional libraries

composer require filp/whoops
composer require twig/twig
composer require twig/intl-extra
composer require doctrine/orm
composer require vlucas/phpdotenv
composer require php-di/php-di --with-all-dependencies
composer require phpunit/phpunit --dev

Directories

mkdir public
mkdir src

.gitignore

vendor/

composer.json autoloader

"autoload": {
    "psr-4": {
        "App\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
        "App\\Test\\": "tests/"
    }
}

Links