-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(slim-lti-skeleton): use slim-skeleton@4.5.0 base
- Loading branch information
Showing
48 changed files
with
5,155 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
json_path: coveralls-upload.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: composer | ||
directory: "/" | ||
schedule: | ||
interval: monthly | ||
open-pull-requests-limit: 10 | ||
versioning-strategy: increase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
tests: | ||
name: Tests PHP ${{ matrix.php }} | ||
runs-on: ubuntu-latest | ||
continue-on-error: ${{ matrix.experimental }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php: [7.4, 8.0, 8.1] | ||
experimental: [false] | ||
include: | ||
- php: 8.1 | ||
analysis: true | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up PHP ${{ matrix.php }} | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
|
||
- name: Install dependencies with Composer | ||
uses: ramsey/composer-install@v2 | ||
|
||
- name: Coding standards | ||
if: matrix.analysis | ||
run: vendor/bin/phpcs | ||
|
||
- name: Static analysis | ||
if: matrix.analysis | ||
run: vendor/bin/phpstan | ||
|
||
- name: Tests | ||
run: vendor/bin/phpunit --coverage-clover clover.xml | ||
|
||
- name: Upload coverage results to Coveralls | ||
if: matrix.analysis | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
composer require php-coveralls/php-coveralls -n -W | ||
vendor/bin/php-coveralls --coverage_clover=clover.xml -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.idea/ | ||
.vscode/ | ||
/coverage/ | ||
/vendor/ | ||
/logs/* | ||
!/logs/README.md | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Options All -Indexes | ||
|
||
<Files .htaccess> | ||
order allow,deny | ||
deny from all | ||
</Files> | ||
|
||
<IfModule mod_rewrite.c> | ||
# Redirect to the public folder | ||
RewriteEngine On | ||
# RewriteBase / | ||
RewriteRule ^$ public/ [L] | ||
RewriteRule (.*) public/$1 [L] | ||
|
||
# Redirect to HTTPS | ||
# RewriteEngine On | ||
# RewriteCond %{HTTPS} off | ||
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# How to Contribute | ||
|
||
## Pull Requests | ||
|
||
1. Fork the Slim Skeleton repository | ||
2. Create a new branch for each feature or improvement | ||
3. Send a pull request from each feature branch to the **4.x** branch | ||
|
||
It is very important to separate new features or improvements into separate feature branches, and to send a | ||
pull request for each branch. This allows us to review and pull in new features or improvements individually. | ||
|
||
## Style Guide | ||
|
||
All pull requests must adhere to the [PSR-12 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-12-extended-coding-style-guide.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Slim Framework 4 Skeleton Application | ||
|
||
[](https://coveralls.io/github/slimphp/Slim-Skeleton?branch=master) | ||
|
||
Use this skeleton application to quickly setup and start working on a new Slim Framework 4 application. This application uses the latest Slim 4 with Slim PSR-7 implementation and PHP-DI container implementation. It also uses the Monolog logger. | ||
|
||
This skeleton application was built for Composer. This makes setting up a new Slim Framework application quick and easy. | ||
|
||
## Install the Application | ||
|
||
Run this command from the directory in which you want to install your new Slim Framework application. You will require PHP 7.4 or newer. | ||
|
||
```bash | ||
composer create-project slim/slim-skeleton [my-app-name] | ||
``` | ||
|
||
Replace `[my-app-name]` with the desired directory name for your new application. You'll want to: | ||
|
||
* Point your virtual host document root to your new application's `public/` directory. | ||
* Ensure `logs/` is web writable. | ||
|
||
To run the application in development, you can run these commands | ||
|
||
```bash | ||
cd [my-app-name] | ||
composer start | ||
``` | ||
|
||
Or you can use `docker-compose` to run the app with `docker`, so you can run these commands: | ||
```bash | ||
cd [my-app-name] | ||
docker-compose up -d | ||
``` | ||
After that, open `http://localhost:8080` in your browser. | ||
|
||
Run this command in the application directory to run the test suite | ||
|
||
```bash | ||
composer test | ||
``` | ||
|
||
That's it! Now go build something cool. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\Application\Settings\SettingsInterface; | ||
use DI\ContainerBuilder; | ||
use Monolog\Handler\StreamHandler; | ||
use Monolog\Logger; | ||
use Monolog\Processor\UidProcessor; | ||
use Psr\Container\ContainerInterface; | ||
use Psr\Log\LoggerInterface; | ||
|
||
return function (ContainerBuilder $containerBuilder) { | ||
$containerBuilder->addDefinitions([ | ||
LoggerInterface::class => function (ContainerInterface $c) { | ||
$settings = $c->get(SettingsInterface::class); | ||
|
||
$loggerSettings = $settings->get('logger'); | ||
$logger = new Logger($loggerSettings['name']); | ||
|
||
$processor = new UidProcessor(); | ||
$logger->pushProcessor($processor); | ||
|
||
$handler = new StreamHandler($loggerSettings['path'], $loggerSettings['level']); | ||
$logger->pushHandler($handler); | ||
|
||
return $logger; | ||
}, | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\Application\Middleware\SessionMiddleware; | ||
use Slim\App; | ||
|
||
return function (App $app) { | ||
$app->add(SessionMiddleware::class); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\Domain\User\UserRepository; | ||
use App\Infrastructure\Persistence\User\InMemoryUserRepository; | ||
use DI\ContainerBuilder; | ||
|
||
return function (ContainerBuilder $containerBuilder) { | ||
// Here we map our UserRepository interface to its in memory implementation | ||
$containerBuilder->addDefinitions([ | ||
UserRepository::class => \DI\autowire(InMemoryUserRepository::class), | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\Application\Actions\User\ListUsersAction; | ||
use App\Application\Actions\User\ViewUserAction; | ||
use Psr\Http\Message\ResponseInterface as Response; | ||
use Psr\Http\Message\ServerRequestInterface as Request; | ||
use Slim\App; | ||
use Slim\Interfaces\RouteCollectorProxyInterface as Group; | ||
|
||
return function (App $app) { | ||
$app->options('/{routes:.*}', function (Request $request, Response $response) { | ||
// CORS Pre-Flight OPTIONS Request Handler | ||
return $response; | ||
}); | ||
|
||
$app->get('/', function (Request $request, Response $response) { | ||
$response->getBody()->write('Hello world!'); | ||
return $response; | ||
}); | ||
|
||
$app->group('/users', function (Group $group) { | ||
$group->get('', ListUsersAction::class); | ||
$group->get('/{id}', ViewUserAction::class); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\Application\Settings\Settings; | ||
use App\Application\Settings\SettingsInterface; | ||
use DI\ContainerBuilder; | ||
use Monolog\Logger; | ||
|
||
return function (ContainerBuilder $containerBuilder) { | ||
|
||
// Global Settings Object | ||
$containerBuilder->addDefinitions([ | ||
SettingsInterface::class => function () { | ||
return new Settings([ | ||
'displayErrorDetails' => true, // Should be set to false in production | ||
'logError' => false, | ||
'logErrorDetails' => false, | ||
'logger' => [ | ||
'name' => 'slim-app', | ||
'path' => isset($_ENV['docker']) ? 'php://stdout' : __DIR__ . '/../logs/app.log', | ||
'level' => Logger::DEBUG, | ||
], | ||
]); | ||
} | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"name": "slim/slim-skeleton", | ||
"description": "A Slim Framework skeleton application for rapid development", | ||
"keywords": [ | ||
"microframework", | ||
"rest", | ||
"router", | ||
"psr7" | ||
], | ||
"homepage": "http://github.com/slimphp/Slim-Skeleton", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Josh Lockhart", | ||
"email": "info@joshlockhart.com", | ||
"homepage": "http://www.joshlockhart.com/" | ||
}, | ||
{ | ||
"name": "Pierre Berube", | ||
"email": "pierre@lgse.com", | ||
"homepage": "http://www.lgse.com/" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.4 || ^8.0", | ||
"ext-json": "*", | ||
"monolog/monolog": "^2.8", | ||
"php-di/php-di": "^6.4", | ||
"slim/psr7": "^1.5", | ||
"slim/slim": "^4.10" | ||
}, | ||
"require-dev": { | ||
"jangregor/phpstan-prophecy": "^1.0.0", | ||
"phpspec/prophecy-phpunit": "^2.0", | ||
"phpstan/extension-installer": "^1.2.0", | ||
"phpstan/phpstan": "^1.8", | ||
"phpunit/phpunit": "^9.5.26", | ||
"squizlabs/php_codesniffer": "^3.7" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"phpstan/extension-installer": true | ||
}, | ||
"process-timeout": 0, | ||
"sort-packages": true | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"App\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Tests\\": "tests/" | ||
} | ||
}, | ||
"scripts": { | ||
"start": "php -S localhost:8080 -t public", | ||
"test": "phpunit" | ||
} | ||
} |
Oops, something went wrong.