Skip to content

Feature/readme and check fixes #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 22 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
rsync.sh
application/configs/application.ini
.idea
cache/
.sass-cache/
public/data/export/*
/data/uploads/
/data/solr/
/public/data/icons/
###> symfony/framework-bundle ###
/.env
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
/vendor/
/nbproject/
/node_modules/
/public/apidoc/
/apidoc/
/public/oaidoc/
/application/configs/application.ini_backup.dist
/application/configs/application_corrupted.ini
/application/configs/application_backup.ini
/application/configs/custom.ini
/data/solr/data/
###< symfony/framework-bundle ###

.DS_Store
.idea


###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###

###> friendsofphp/php-cs-fixer ###
/.php_cs
/.php_cs.cache
###< friendsofphp/php-cs-fixer ###
8 changes: 8 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
])
;
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# OpenSkos-API
Restful API for OpenSkos

This is a new API for the OpenSkos project. The aim is to have a great speed/reaction advantage
in this API compared to the original projects when making changes to the database.


## Docker
Everything regarding the Docker setup/configuration can be found in the `/docker` directory.

The folder `/docker/nginx` contains all configuration files for the NginX container.

The folder `/docker/fpm` contains all configuration files for the Php-Fpm container.

## Development installation:

composer install -o
docker-compose up -d

The envirioment should be up & running at http://localhost:9020.
Open http://localhost:9020/ping to open the healthcheck page and see if the setup has gone correctly. The text
`Hello OpenSkos world!` should be displayed.


## GrumPHP, PHPCS fixer & PHPStan
This project uses these pacakges to have some enforce code styling and quality. Before committing your work
your should run `composer grumphp` to see if the code passes the checks. If not, it's possible to run
`composer phpcsfixer` to try to automaticly fix the issues. Then try `composer grumphp` again. If errors stil occur,
manual corrections are needed. The error messages should contain the nessesery information to help to locate & fix the problem.
Once `composer grumphp` passes, you can commit your code to your feature branch.

To run grump

composer grumphp

To run PhpCs (just checking for errors)

composer phpcs

To PhPCsFixer (checking & fixing errors when possible)

composer phpcsfixer
42 changes: 42 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

if (false === 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';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

$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');
}

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
78 changes: 78 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"sensio/framework-extra-bundle": "^5.3",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/flex": "^1.1",
"symfony/framework-bundle": "4.2.*",
"symfony/yaml": "4.2.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
],
"grumphp": [
"./vendor/bin/grumphp run"
],
"phpstan": [
"./vendor/bin/phpstan analyse src"
],
"phpcs": [
"./vendor/bin/phpcs src"
],
"phpcsfixer": [
"./vendor/bin/php-cs-fixer fix src"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.2.*"
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.15",
"phpro/grumphp": "^0.15.0",
"phpstan/phpstan": "^0.11.6",
"squizlabs/php_codesniffer": "^3.4"
}
}
Loading