httpsoft/http-app

HTTP Software Application Template

1.1.0 2023-05-05 23:05 UTC

This package is auto-updated.

Last update: 2024-10-22 00:27:20 UTC


README

License Latest Stable Version Total Downloads GitHub Build Status GitHub Static Analysis Status Scrutinizer Code Coverage Scrutinizer Code Quality

HTTP application template for quickly creating simple but powerful web applications and APIs. «Out of the box», the application template is configured to work with JSON for rapid REST API development.

The core of this application template is the httpsoft/http-basis microframework. By default, the devanych/di-container that implements PSR-11 and the monolog/monolog logger that implements PSR-3 are also used. You can easily change the container and logger to your preferred implementations of the corresponding PSRs.

Documentation

Installation

This project template requires PHP version 7.4 or later.

composer create-project --prefer-dist httpsoft/http-app <app-dir>

To verify the installation, go to <app-dir> and start the PHP built-in web server:

cd <app-dir>
composer run serve

After that, open http://localhost:8080 in your browser.

Testing and checking

The following commands are run in the application directory:

  • composer run test — runs tests.
  • composer run static — runs static analysis code.
  • composer run cs-check — runs checking coding standards.
  • composer run cs-fix — runs automatic correction of violations of encoding standards.
  • composer run check — runs checking coding standards, static analysis code and tests.

Directory structure

By default, the application template has the following structure:

bin/                  Executable console scripts.
    chmod-var.php     Recursively changing the "var/" directory mode.
config/               Configuration files.
    config.php        Main configuration.
    container.php     Dependency injection.
    pipeline.php      Middleware pipeline.
    routes.php        HTTP request routes.
public/               Files publically accessible from the Internet.
    index.php         Entry script.
src/                  Application source code.
    Http/             HTTP application classes (actions, middelware, etc.).
    Infrastructure/   Helper classes (factories, listeners, etc.).
    Model/            Domain model classes (entities, repositories, etc.).
tests/                A set of tests for the application.
vendor/               Installed Composer packages.
var/                  Temporary files (logs, cache, etc.).

You can change the structure of the application template as you like.