#1 - skeleton polishing (#12)

* #1 - skeleton polishing

* #1 - readme
This commit is contained in:
Krzysztof Rewak 2022-01-12 08:49:22 +01:00 committed by GitHub
parent 262d37d862
commit 2abd83526d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1346 additions and 77 deletions

View File

@ -1,4 +1,5 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: composer - package-ecosystem: composer
directory: "/" directory: "/"
@ -9,6 +10,7 @@ updates:
prefix: "#5 - (php) " prefix: "#5 - (php) "
target-branch: main target-branch: main
open-pull-requests-limit: 1 open-pull-requests-limit: 1
- package-ecosystem: npm - package-ecosystem: npm
directory: "/" directory: "/"
schedule: schedule:

View File

@ -12,5 +12,6 @@ jobs:
check-pr-title: check-pr-title:
name: Check PR title name: Check PR title
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: blumilksoftware/action-pr-title@v1.2.0 - uses: blumilksoftware/action-pr-title@v1.2.0

View File

@ -6,6 +6,7 @@ on:
jobs: jobs:
test-and-lint-js: test-and-lint-js:
name: Test & lint JS stuff
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:

View File

@ -8,6 +8,7 @@ on:
jobs: jobs:
test-and-lint-php: test-and-lint-php:
name: Test & lint PHP stuff
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:

View File

@ -7,11 +7,9 @@ namespace Toby\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable class User extends Authenticatable
{ {
use HasApiTokens;
use HasFactory; use HasFactory;
use Notifiable; use Notifiable;

View File

@ -2,23 +2,19 @@
declare(strict_types=1); declare(strict_types=1);
$app = new Illuminate\Foundation\Application( use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
$_ENV["APP_BASE_PATH"] ?? dirname(__DIR__), use Illuminate\Contracts\Debug\ExceptionHandler as HandlerContract;
); use Illuminate\Contracts\Http\Kernel as HttpKernelContract;
use Illuminate\Foundation\Application;
use Toby\Console\Kernel as ConsoleKernel;
use Toby\Exceptions\Handler;
use Toby\Http\Kernel as HttpKernel;
$app->singleton( $basePath = $_ENV["APP_BASE_PATH"] ?? dirname(__DIR__);
Illuminate\Contracts\Http\Kernel::class, $application = new Application($basePath);
Toby\Http\Kernel::class,
);
$app->singleton( $application->singleton(HttpKernelContract::class, HttpKernel::class);
Illuminate\Contracts\Console\Kernel::class, $application->singleton(ConsoleKernelContract::class, ConsoleKernel::class);
Toby\Console\Kernel::class, $application->singleton(HandlerContract::class, Handler::class);
);
$app->singleton( return $application;
Illuminate\Contracts\Debug\ExceptionHandler::class,
Toby\Exceptions\Handler::class,
);
return $app;

View File

@ -16,6 +16,7 @@
}, },
"require-dev": { "require-dev": {
"blumilksoftware/codestyle": "^0.9.0", "blumilksoftware/codestyle": "^0.9.0",
"enlightn/enlightn": "^1.22",
"facade/ignition": "^2.5", "facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"mockery/mockery": "^1.4.4", "mockery/mockery": "^1.4.4",

1228
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@
declare(strict_types=1); declare(strict_types=1);
use Toby\Models\User;
return [ return [
"defaults" => [ "defaults" => [
"guard" => "web", "guard" => "web",
@ -16,7 +18,7 @@ return [
"providers" => [ "providers" => [
"users" => [ "users" => [
"driver" => "eloquent", "driver" => "eloquent",
"model" => Toby\Models\User::class, "model" => User::class,
], ],
], ],
"passwords" => [ "passwords" => [

68
config/enlightn.php Normal file
View File

@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
return [
"analyzers" => ["*"],
"exclude_analyzers" => [],
"ci_mode_exclude_analyzers" => [],
"analyzer_paths" => [
"Enlightn\\Enlightn\\Analyzers" => base_path("vendor/enlightn/enlightn/src/Analyzers"),
"Enlightn\\EnlightnPro\\Analyzers" => base_path("vendor/enlightn/enlightnpro/src/Analyzers"),
],
"base_path" => [
app_path(),
database_path("migrations"),
database_path("seeders"),
],
"skip_env_specific" => env("ENLIGHTN_SKIP_ENVIRONMENT_SPECIFIC", false),
"guest_url" => null,
"dont_report" => [],
"ignore_errors" => [],
"license_whitelist" => [
"Apache-2.0",
"Apache2",
"BSD-2-Clause",
"BSD-3-Clause",
"LGPL-2.1-only",
"LGPL-2.1",
"LGPL-2.1-or-later",
"LGPL-3.0",
"LGPL-3.0-only",
"LGPL-3.0-or-later",
"MIT",
"ISC",
"CC0-1.0",
"Unlicense",
"WTFPL",
],
"credentials" => [
"username" => env("ENLIGHTN_USERNAME"),
"api_token" => env("ENLIGHTN_API_TOKEN"),
],
"github_repo" => env("ENLIGHTN_GITHUB_REPO"),
"compact_lines" => true,
"commercial_packages" => [
"enlightn/enlightnpro",
],
"allowed_permissions" => [
base_path() => "775",
app_path() => "775",
resource_path() => "775",
storage_path() => "775",
public_path() => "775",
config_path() => "775",
database_path() => "775",
base_path("routes") => "775",
app()->bootstrapPath() => "775",
app()->bootstrapPath("cache") => "775",
app()->bootstrapPath("app.php") => "664",
base_path("artisan") => "775",
public_path("index.php") => "664",
public_path("server.php") => "664",
],
"writable_directories" => [
storage_path(),
app()->bootstrapPath("cache"),
],
];

View File

@ -5,9 +5,9 @@ declare(strict_types=1);
use Blumilk\Codestyle\Config; use Blumilk\Codestyle\Config;
use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths; use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths;
$paths = (new LaravelPaths())->add("public", "bootstrap/app.php", "ecs.php"); $paths = new LaravelPaths();
$config = new Config( $config = new Config(
paths: $paths, paths: $paths->add("public", "bootstrap/app.php", "ecs.php", "server.php"),
); );
return $config->config(); return $config->config();

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{ {
"name": "toby", "name": "application",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@ -1,21 +0,0 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

View File

@ -1,6 +1,8 @@
![He's watching you](toby.png)
# Toby # Toby
HR software you love to hate > HR software you love to hate
## Local setup ## Local setup
@ -39,19 +41,22 @@ HR software you love to hate
dcr node npm run dev dcr node npm run dev
## Available containers (local) ### Available containers (local)
- **web** - nginx HTTP server
- **php** - php and composer stuff - **php** - php and composer stuff
- **node** - npm stuff - **node** - npm stuff
- **mysql** - database for local development - **mysql** - database for local development
- **mailhog** - for emails preview - **mailhog** - for emails preview
## Running tests ### Running tests
If xDebug is installed, set environment variable **XDEBUG_MODE=off** to improve performance If xDebug is installed, set environment variable **XDEBUG_MODE=off** to improve performance
dcr -e XDEBUG_MODE=off php php artisan test dcr -e XDEBUG_MODE=off php php artisan test
### Code style check
## Code style check
dcr php php vendor/bin/ecs check dcr php php vendor/bin/ecs check
dcr php composer ecs dcr php composer ecs
dcr php php vendor/bin/ecs check --fix dcr php php vendor/bin/ecs check --fix
@ -59,13 +64,14 @@ If xDebug is installed, set environment variable **XDEBUG_MODE=off** to improve
dcr node npm run lint dcr node npm run lint
dcr node rpm run lintf dcr node rpm run lintf
## xDebug ### xDebug
To use xDebug you need to set `DOCKER_INSTALL_XDEBUG` to `true` in `.env` file.\ * To use xDebug you need to set `DOCKER_INSTALL_XDEBUG` to `true` in `.env` file.
Then rebuild php container `docker-compose up --build -d php`.\ * Then rebuild php container `docker-compose up --build -d php`.
You can also set up xDebug params (see docs https://xdebug.org/docs/all_settings) in `docker/dev/php/php.ini` file: * You can also set up xDebug params (see docs https://xdebug.org/docs/all_settings) in `docker/dev/php/php.ini` file:
Default values for xDebug: Default values for xDebug:
``` ```
xdebug.client_host=host.docker.internal xdebug.client_host=host.docker.internal
xdebug.client_port=9003 xdebug.client_port=9003
@ -74,16 +80,19 @@ xdebug.start_with_request=yes
xdebug.log_level=0 xdebug.log_level=0
``` ```
### Disable xDebug #### Disable xDebug
it is possible to disable the Xdebug completely by setting the option **xdebug.mode** to **off**,
or by setting the environment variable **XDEBUG_MODE=off**\ * It is possible to disable the Xdebug completely by setting the option **xdebug.mode** to **off**, or by setting the environment variable **XDEBUG_MODE=off**.
See docs (https://xdebug.org/docs/all_settings#mode) * See docs: (https://xdebug.org/docs/all_settings#mode)
CLI: CLI:
``` ```
XDEBUG_MODE=off php artisan test XDEBUG_MODE=off php artisan test
``` ```
Docker container: Docker container:
``` ```
docker-compose run --rm -e XDEBUG_MODE=off php php artisan test docker-compose run --rm -e XDEBUG_MODE=off php php artisan test
``` ```

View File

@ -1,8 +1,3 @@
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
Route::middleware("auth:sanctum")->get("/user", fn(Request $request) => $request->user());

View File

@ -1,21 +1,11 @@
<?php <?php
/** declare(strict_types=1);
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
$uri = urldecode( $uri = urldecode(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH));
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the if ($uri !== "/" && file_exists(__DIR__ . "/public" . $uri)) {
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
return false; return false;
} }
require_once __DIR__.'/public/index.php'; require_once __DIR__ . "/public/index.php";

BIN
toby.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@ -6,4 +6,4 @@ module.exports = {
'@': path.resolve('resources/js') '@': path.resolve('resources/js')
} }
} }
} };