Skip to content

Commit 8a2bbd9

Browse files
committed
Initial commit
0 parents  commit 8a2bbd9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+11394
-0
lines changed

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = LF
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.{php,html,twig}]
13+
indent_style = space
14+
indent_size = 4
15+
16+
[*.md]
17+
max_line_length = 80
18+
19+
[COMMIT_EDITMSG]
20+
max_line_length = 0

.env.dist

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
###> symfony/framework-bundle ###
3+
APP_ENV=dev
4+
APP_SECRET=ffeb0fb299e229d4589a43f8851d1993
5+
###< symfony/framework-bundle ###
6+
7+
###> symfony/messenger ###
8+
MESSENGER_TRANSPORT_DSN=doctrine://default
9+
###< symfony/messenger ###
10+
11+
###> symfony/mailer ###
12+
MAILER_DSN=null://default
13+
###< symfony/mailer ###
14+
15+
###> doctrine/doctrine-bundle ###
16+
DATABASE_URL="mysql://root:root@lexthink-php_skeleton-mysql:3306/database?serverVersion=8.0"
17+
###< doctrine/doctrine-bundle ###

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
###> Other files and folders ###
3+
.idea
4+
.vscode
5+
.env
6+
docker-compose.yaml
7+
###< Other files and folders ###
8+
9+
###> symfony/framework-bundle ###
10+
/.env.local
11+
/.env.local.php
12+
/.env.*.local
13+
/config/secrets/prod/prod.decrypt.private.php
14+
/public/bundles/
15+
/var/
16+
/vendor/
17+
###< symfony/framework-bundle ###
18+
19+
###> friendsofphp/php-cs-fixer ###
20+
/.php_cs
21+
/.php_cs.cache
22+
###< friendsofphp/php-cs-fixer ###
23+
24+
###> squizlabs/php_codesniffer ###
25+
/.phpcs-cache
26+
/phpcs.xml
27+
###< squizlabs/php_codesniffer ###
28+
29+
###> phpunit/phpunit ###
30+
/phpunit.xml
31+
.phpunit.result.cache
32+
###< phpunit/phpunit ###
33+
34+
###> symfony/phpunit-bridge ###
35+
.phpunit
36+
.phpunit.result.cache
37+
/phpunit.xml
38+
###< symfony/phpunit-bridge ###
39+
40+
###> phpstan/phpstan ###
41+
/phpstan.neon
42+
.phpstan.cache
43+
###< phpstan/phpstan ###

.php-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.0

.php_cs.dist

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
$finder = (new PhpCsFixer\Finder())
4+
->in(__DIR__)
5+
->exclude('var')
6+
;
7+
8+
return (new PhpCsFixer\Config())
9+
->setRiskyAllowed(true)
10+
->setRules([
11+
'@Symfony' => true,
12+
'@Symfony:risky' => true,
13+
'array_syntax' => ['syntax' => 'short'],
14+
'declare_strict_types' => true,
15+
'linebreak_after_opening_tag' => true,
16+
'mb_str_functions' => true,
17+
'no_useless_else' => true,
18+
'no_useless_return' => true,
19+
'phpdoc_order' => true,
20+
'strict_comparison' => true,
21+
'strict_param' => true,
22+
])
23+
->setFinder($finder)
24+
;

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Manuel Alejandro Paz Cetina
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
OS = $(shell uname)
4+
UID = $(shell id -u)
5+
DOCKER_NETWORK = lexthink-php_skeleton-network
6+
DOCKER_PHP = lexthink-php_skeleton-php
7+
8+
help: ## Show this help message
9+
@echo 'usage: make [target]'
10+
@echo
11+
@echo 'targets:'
12+
@egrep '^(.+)\:\ ##\ (.+)' ${MAKEFILE_LIST} | column -t -c 2 -s ':#'
13+
14+
build: ## Rebuilds all the containers
15+
docker network create ${DOCKER_NETWORK} || true
16+
cp -n docker-compose.yaml.dist docker-compose.yaml || true
17+
cp -n .env.dist .env || true
18+
U_ID=${UID} docker-compose build
19+
20+
start: ## Start the containers
21+
docker network create ${DOCKER_NETWORK} || true
22+
cp -n docker-compose.yaml.dist docker-compose.yaml || true
23+
cp -n .env.dist .env || true
24+
U_ID=${UID} docker-compose up -d
25+
26+
stop: ## Stop the containers
27+
U_ID=${UID} docker-compose stop
28+
29+
restart: ## Restart the containers
30+
$(MAKE) stop && $(MAKE) start
31+
32+
install: ## Installs composer dependencies
33+
U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer install --no-interaction
34+
35+
migrations: ## Runs doctrine migrations
36+
U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} bin/console doctrine:migration:migrate -n --allow-no-migration
37+
38+
logs: ## Tails the Symfony dev log
39+
U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} tail -f var/log/dev.log
40+
41+
bash: ## bash into the be container
42+
U_ID=${UID} docker exec -it --user ${UID} ${DOCKER_PHP} bash
43+
44+
fix-style: ## Fix code style errors using php-cs-fixer and phpcbf
45+
U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer dev:fix-style
46+
47+
tests: ## Runs the entire test suite
48+
U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer dev:tests
49+
50+
coverage: ## Runs phpunit with xdebug and storage coverage in var/coverage/html/
51+
U_ID=${UID} docker exec --user ${UID} ${DOCKER_PHP} composer dev:coverage
52+
53+
.PHONY: help build start stop restart install migrations logs bash fix-style tests coverage

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# lexthink/php-skeleton
2+
3+
[![Source Code][badge-source]][source]
4+
[![Latest Version][badge-release]][release]
5+
[![Software License][badge-license]][license]
6+
7+
📦 This package provides a basic configuration to start building your next project using Symfony.
8+
9+
## Installation
10+
11+
Download the project repository to your local directory:
12+
```shell
13+
git clone git@github.com:lexthink/php-skeleton.git
14+
```
15+
16+
Open your terminal in the local project, and execute:
17+
```shell
18+
make build
19+
```
20+
21+
Then start the containers and install the dependencies with:
22+
```shell
23+
make start && make install
24+
```
25+
26+
Go to http://localhost:8000/health-check to check that everything is ok.
27+
28+
## Copyright and License
29+
30+
The `lexthink/php-skeleton` project is copyright ©
31+
[Manuel Alejadro Paz Cetina](https://github.com/lexthink/php-skeleton)
32+
and licensed for use under the MIT License (MIT). Please see [LICENSE][]
33+
for more information.
34+
35+
[source]: https://github.com/lexthink/php-skeleton
36+
[release]: https://github.com/lexthink/php-skeleton/releases
37+
[license]: https://github.com/lexthink/php-skeleton/blob/main/LICENSE
38+
39+
[badge-source]: https://img.shields.io/badge/source-lexthink/php--skeleton-blue?style=flat-square
40+
[badge-release]: https://img.shields.io/github/release/lexthink/php-skeleton?style=flat-square
41+
[badge-license]: https://img.shields.io/github/license/lexthink/php-skeleton?style=flat-square

bin/console

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
use App\Kernel;
5+
use Symfony\Bundle\FrameworkBundle\Console\Application;
6+
use Symfony\Component\Console\Input\ArgvInput;
7+
use Symfony\Component\Dotenv\Dotenv;
8+
use Symfony\Component\ErrorHandler\Debug;
9+
10+
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
11+
echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
12+
}
13+
14+
set_time_limit(0);
15+
16+
require dirname(__DIR__).'/vendor/autoload.php';
17+
18+
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) {
19+
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.');
20+
}
21+
22+
$input = new ArgvInput();
23+
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
24+
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
25+
}
26+
27+
if ($input->hasParameterOption('--no-debug', true)) {
28+
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
29+
}
30+
31+
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
32+
33+
if ($_SERVER['APP_DEBUG']) {
34+
umask(0000);
35+
36+
if (class_exists(Debug::class)) {
37+
Debug::enable();
38+
}
39+
}
40+
41+
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
42+
$application = new Application($kernel);
43+
$application->run($input);

bin/phpunit

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
if (!file_exists(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
5+
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
6+
exit(1);
7+
}
8+
9+
if (false === getenv('SYMFONY_PHPUNIT_DIR')) {
10+
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
11+
}
12+
13+
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';

0 commit comments

Comments
 (0)