Skip to content
This repository has been archived by the owner on Oct 25, 2021. It is now read-only.

Commit

Permalink
add slim skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
iagapie committed Oct 14, 2020
1 parent bc8b7ea commit d551976
Show file tree
Hide file tree
Showing 33 changed files with 6,227 additions and 44 deletions.
24 changes: 24 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# In all environments, the following files are loaded if they exist,
# the latter taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.

APP_NAME="Slim Skeleton"
APP_VERSION="1.0.0"
APP_ENV=dev

###> doctrine/dbal ###
DATABASE_URL=mysql://user:password@localhost:3306/db-name?serverVersion=8.0&charset=UTF8
###< doctrine/dbal ###

###> monolog/monolog ###
# DEBUG | INFO | NOTICE | WARNING | ERROR | CRITICAL | ALERT | EMERGENCY
LOGGER_LEVEL=DEBUG
###< monolog/monolog ###
52 changes: 9 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,52 +1,18 @@
# Cache and logs (Symfony2)
/app/cache/*
/app/logs/*
!app/cache/.gitkeep
!app/logs/.gitkeep

# Email spool folder
/app/spool/*

# Cache, session files and logs (Symfony3)
.idea
.env
/bin/*
!bin/console
/vendor
/var/cache/*
/var/logs/*
/var/sessions/*
!var/cache/.gitkeep
!var/logs/.gitkeep
!var/sessions/.gitkeep

# Logs (Symfony4)
/var/log/*
!var/log/.gitkeep

# Parameters
/app/config/parameters.yml
/app/config/parameters.ini

# Managed by Composer
/app/bootstrap.php.cache
/var/bootstrap.php.cache
/bin/*
!bin/console
!bin/symfony_requirements
/vendor/

# Assets and user uploads
/web/bundles/
/web/uploads/
!var/cache/.gitignore
!var/logs/.gitignore
!var/sessions/.gitignore

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

# Composer PHAR
/composer.phar

# Backup entities generated with doctrine:generate:entities command
**/Entity/*~
.phpunit.result.cache

# Embedded web-server pid file
/.web-server-pid
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# slim-skeleton
# Slim 4 Skeleton Application

## Install

From directory in which you want to install your new application, run this command:

```bash
composer create-project iagapie/slim-skeleton [app-name]
```

Replace `[app-name]` with name of your new application. You'll want to:

* Point your virtual host document root to your new application's `public/` directory.
* Ensure `var/logs/` and `var/cache/` is writable.

To run the application in development, you can run these commands

```bash
cd [app-name]
composer serve
```

To run the test suite:

```bash
composer test
```

## License

The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.
32 changes: 32 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

use App\Infrastructure\Kernel;
use App\Infrastructure\Cli;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;

if (!\in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
}

\set_time_limit(0);

require \dirname(__DIR__).'/vendor/autoload.php';

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
\putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
\putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

(new Dotenv())->bootEnv(\dirname(__DIR__).'/.env');

$kernel = new Kernel($_SERVER['APP_NAME'], $_SERVER['APP_VERSION'], $_SERVER['APP_ENV'], (bool)$_SERVER['APP_DEBUG']);
$cli = $kernel->getContainer()->get(Cli::class);
$cli->run($input);
58 changes: 58 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "iagapie/slim-skeleton",
"description": "Slim 4 Skeleton Application",
"keywords": [
"slim",
"slim-skeleton",
"psr7",
"php7",
"microframework"
],
"license": "MIT",
"authors": [
{
"name": "Igor Agapie",
"email": "igoragapie@gmail.com"
}
],
"require": {
"php": ">=7.4",
"ext-json": "*",
"ext-xml": "*",
"doctrine/migrations": "^3.0",
"monolog/monolog": "^2.1",
"slim/psr7": "^1.2",
"slim/slim": "^4.5",
"symfony/config": "^5.1",
"symfony/console": "^5.1",
"symfony/dependency-injection": "^5.1",
"symfony/dotenv": "^5.1",
"symfony/yaml": "^5.1"
},
"require-dev": {
"phpunit/phpunit": "^9.4",
"fzaninotto/faker": "^1.9",
"mikey179/vfsstream": "^1.6"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"scripts": {
"serve": "php -S localhost:8888 -t public",
"test": "phpunit"
}
}
Loading

0 comments on commit d551976

Please sign in to comment.