Git Product home page Git Product logo

slim4-app's Introduction

Slim 4 App

Based in Slim 4 Skeleton Application, this project enhances the codebase using a more complete Docker stack, .env file support and database-connection setup.

Features

  • Based in Slim 4 Framework with Slim PSR-7 implementation and PHP-DI container implementation.
  • Uses the Monolog logger.
  • Built for Composer (Set up a new Slim Framework quick and easy).
  • Support for .env config file.
  • Use illuminate/database Query Builder.
  • Useful Makefile shortcuts.

Install the Application

Run this command from the directory in which you want to install your new Slim Framework application.

git clone https://github.com/javiertapia/slim4-app.git [my-app-name]

Where [my-app-name] is the directory name for the new application.

  • The host document root is the public/ directory.
  • The logs/ directory must be web writable.

To run the application in development, using docker-compose:

cd [my-app-name]
docker-compose up

The first time this command pull the required docker images and build the services. This can take a while.

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

Create users table using:

create table users
(
    id int auto_increment
        primary key,
    username varchar(255) null,
    email varchar(255) null,
    first_name varchar(255) null,
    last_name varchar(255) null,
    constraint username
        unique (username)
)
    collate=utf8mb4_unicode_ci;

Makefile shortcuts

At the command line, put into the project directory and run this shortcuts:

make d-up

Start all the docker containers in detached mode (i.e, these will run in background). Is a shortcut for the command docker-compose up -d.

make d-down

Stop all docker containers. Is a shortcut of docker-compose down.

make d-bash

Open the shell /bin/sh into the php container's service. Is a shortcut of docker-compose exec php /bin/sh.

make d-test

Run phpunit tests at /www/tests directory, using /www/tests/bootstrap.php as bootstrap file.

make d-composer

Run composer install from the container's image, over the project's composer.json file. Is a shortcut of docker-compose exec php /bin/sh -c "cd /www && composer install"

make phpstan [DIR=<dir>]

Execute PhpStan from his official docker image, over a specified directory. The DIR parameter is optional. Is a shortcut of docker run --rm -v .:/www ghcr.io/phpstan/phpstan --level=7 analyse /www/src/<dir> --autoload-file /www/vendor/autoload.php

make help

Show a summary of the available make commands.

(Desired) features

  • Configuration object
  • Custom error handler
  • Error logger
  • .env support
  • Setup database connection
  • Setup mailer
  • Twig Template system
  • MtHaml Template system

slim4-app's People

Contributors

l0gicgate avatar dependabot-preview[bot] avatar akrabat avatar javiertapia avatar flangofas avatar maccath avatar jeremykendall avatar agung-ap avatar silentworks avatar manavo avatar samsonasik avatar ssnepenthe avatar antoninom90 avatar yakubenko avatar maurobonfietti avatar mbohal avatar jamesrweb avatar geggleto avatar casmith avatar atefbb avatar a-r-m-i-n avatar antnee avatar localheinz avatar wackazong avatar tsia avatar tomtomsen avatar mtorres avatar dependabot[bot] avatar shahariaazam avatar holtkamp avatar

Stargazers

Marc avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.