-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fb3a227
Showing
113 changed files
with
19,618 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Debug mode disabled view cache and enabled higher verbosity. | ||
DEBUG = false | ||
|
||
# Set to application specific value, used to encrypt/decrypt cookies and etc. | ||
ENCRYPTER_KEY = {encrypt-key} | ||
|
||
# Set to TRUE to disable confirmation in `migrate` commands. | ||
SAFE_MIGRATIONS = true |
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,11 @@ | ||
*.sh text eol=lf | ||
*.js text eol=lf | ||
*.ts text eol=lf | ||
*.css text eol=lf | ||
*.php text eol=lf | ||
*.json text eol=lf | ||
public/keeper/keeper.js binary | ||
public/keeper/keeper*.css binary | ||
public/keeper/keeper*.css.map binary | ||
public/public/toolkit*.js binary | ||
public/public/toolkit*.map binary |
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,11 @@ | ||
.idea | ||
vendor | ||
runtime | ||
node_modules | ||
rr* | ||
spiral | ||
spiral.exe | ||
.env | ||
.phpunit.result.cache | ||
app.db | ||
*.js___jb_tmp___ |
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,20 @@ | ||
http: | ||
address: 0.0.0.0:8080 | ||
workers: | ||
command: "php app.php" | ||
|
||
static: | ||
dir: "public" | ||
forbid: [".php", ".htaccess"] | ||
|
||
jobs: | ||
pipelines: | ||
local.broker: ephemeral | ||
dispatch: | ||
app-*.pipeline: "local" | ||
consume: ["local"] | ||
workers: | ||
command: "php app.php" | ||
|
||
metrics: | ||
address: localhost:2112 |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 Spiral Scout | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,12 @@ | ||
# Keeper demo | ||
|
||
Install: | ||
|
||
```bash | ||
$ composer install | ||
$ php app.php migrate:init | ||
$ php app.php migrate | ||
$ php app.php cycle | ||
$ php app.php configure | ||
$ php app.php user:seed | ||
``` |
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,23 @@ | ||
<?php | ||
|
||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
mb_internal_encoding('UTF-8'); | ||
error_reporting(E_ALL | E_STRICT); | ||
ini_set('display_errors', 'stderr'); | ||
|
||
require __DIR__ . '/vendor/autoload.php'; | ||
|
||
// initiate shared container, bindings, directories and etc | ||
$app = \App\App::init(['root' => __DIR__]); | ||
|
||
if ($app != null) { | ||
$app->serve(); | ||
} |
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,25 @@ | ||
<?php | ||
|
||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Spiral\Database\Driver; | ||
|
||
return [ | ||
'default' => 'default', | ||
'databases' => [ | ||
'default' => ['driver' => 'runtime'], | ||
], | ||
'drivers' => [ | ||
'runtime' => [ | ||
'driver' => Driver\SQLite\SQLiteDriver::class, | ||
'connection' => 'sqlite:' . directory('root') . 'app.db', | ||
], | ||
] | ||
]; |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
return [ | ||
'GitHub' => 'GitHub', | ||
'Exception' => 'Страница ошибки', | ||
'Create Queue Task' => 'Создать фоновую задачу', | ||
'Application Metrics' => 'Prometheus метрики', | ||
'Website and Documentation' => 'Документация', | ||
'Welcome To Spiral' => 'Добро пожаловать', | ||
'Welcome to Spiral Framework' => 'Вас приветствует Spiral Framework', | ||
'This view file is located in' => 'Данный шаблон находится в файле', | ||
'and rendered by' => 'и вызван контроллером', | ||
]; |
84 changes: 84 additions & 0 deletions
84
app/migrations/20200508.172301_0_0_default_create_users_create_auth_tokens.php
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,84 @@ | ||
<?php | ||
|
||
namespace Migration; | ||
|
||
use Spiral\Migrations\Migration; | ||
|
||
class OrmDefault051eebb15f80002ca7b02665c8e55f5f extends Migration | ||
{ | ||
protected const DATABASE = 'default'; | ||
|
||
public function up() | ||
{ | ||
$this->table('users') | ||
->addColumn('id', 'bigPrimary', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('email', 'string', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('password', 'string', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('first_name', 'string', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('last_name', 'string', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('roles', 'string', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('created_at', 'datetime', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('updated_at', 'datetime', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addIndex(["email"], [ | ||
'name' => 'users_index_email_5eb5957567507', | ||
'unique' => true | ||
]) | ||
->setPrimaryKeys(["id"]) | ||
->create(); | ||
|
||
$this->table('auth_tokens') | ||
->addColumn('id', 'string', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('hashed_value', 'string', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('created_at', 'datetime', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->addColumn('expires_at', 'datetime', [ | ||
'nullable' => true, | ||
'default' => null | ||
]) | ||
->addColumn('payload', 'binary', [ | ||
'nullable' => false, | ||
'default' => null | ||
]) | ||
->setPrimaryKeys(["id"]) | ||
->create(); | ||
} | ||
|
||
public function down() | ||
{ | ||
$this->table('auth_tokens')->drop(); | ||
|
||
$this->table('users')->drop(); | ||
} | ||
} |
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,96 @@ | ||
<?php | ||
|
||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App; | ||
|
||
use App\Bootloader; | ||
use Spiral\Bootloader as Framework; | ||
use Spiral\DataGrid\Bootloader as DataGrid; | ||
use Spiral\DotEnv\Bootloader as DotEnv; | ||
use Spiral\Framework\Kernel; | ||
use Spiral\Monolog\Bootloader as Monolog; | ||
use Spiral\Nyholm\Bootloader as Nyholm; | ||
use Spiral\Prototype\Bootloader as Prototype; | ||
use Spiral\Router\Bootloader as Router; | ||
use Spiral\Scaffolder\Bootloader as Scaffolder; | ||
use Spiral\Stempler\Bootloader as Stempler; | ||
|
||
class App extends Kernel | ||
{ | ||
/* | ||
* List of components and extensions to be automatically registered | ||
* within system container on application start. | ||
*/ | ||
protected const LOAD = [ | ||
/* -- debug and profiling --*/ | ||
DotEnv\DotenvBootloader::class, | ||
Monolog\MonologBootloader::class, | ||
Framework\SnapshotsBootloader::class, | ||
Framework\DebugBootloader::class, | ||
Framework\Debug\LogCollectorBootloader::class, | ||
Framework\Debug\HttpCollectorBootloader::class, | ||
|
||
/* -- application specific logging --*/ | ||
Bootloader\LoggingBootloader::class, | ||
|
||
/* -- validation, security and encryption --*/ | ||
Framework\Security\EncrypterBootloader::class, | ||
Framework\Security\ValidationBootloader::class, | ||
Framework\Security\FiltersBootloader::class, | ||
Framework\Security\GuardBootloader::class, | ||
|
||
/* -- HTTP --*/ | ||
Nyholm\NyholmBootloader::class, | ||
Framework\Http\ErrorHandlerBootloader::class, | ||
Framework\Http\CookiesBootloader::class, | ||
Framework\Http\SessionBootloader::class, | ||
Framework\Http\CsrfBootloader::class, | ||
Framework\Http\PaginationBootloader::class, | ||
|
||
/* -- ORM and databases --*/ | ||
Framework\Database\DatabaseBootloader::class, | ||
Framework\Database\MigrationsBootloader::class, | ||
Framework\Cycle\CycleBootloader::class, | ||
Framework\Cycle\ProxiesBootloader::class, | ||
Framework\Cycle\AnnotatedBootloader::class, | ||
|
||
/* -- stempler and views --*/ | ||
Framework\Views\ViewsBootloader::class, | ||
Framework\Views\TranslatedCacheBootloader::class, | ||
Stempler\StemplerBootloader::class, | ||
Stempler\PrettyPrintBootloader::class, | ||
|
||
/* -- security and auth context --*/ | ||
Framework\Auth\HttpAuthBootloader::class, | ||
Framework\Auth\TokenStorage\CycleTokensBootloader::class, | ||
Framework\Auth\SecurityActorBootloader::class, | ||
|
||
/* -- other components --*/ | ||
Framework\I18nBootloader::class, | ||
Framework\Jobs\JobsBootloader::class, | ||
|
||
/* -- data rendering --*/ | ||
DataGrid\GridBootloader::class, | ||
|
||
/* -- routes and middleware -- */ | ||
Router\AnnotatedRoutesBootloader::class, | ||
Bootloader\LocaleSelectorBootloader::class, | ||
|
||
/* -- security and admin panels --*/ | ||
Bootloader\SecurityBootloader::class, | ||
Bootloader\AdminBootloader::class, | ||
|
||
/* -- development helpers --*/ | ||
Framework\CommandBootloader::class, | ||
Prototype\PrototypeBootloader::class, | ||
Scaffolder\ScaffolderBootloader::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,40 @@ | ||
<?php | ||
|
||
/** | ||
* Spiral Framework. | ||
* | ||
* @license MIT | ||
* @author Anton Titov (Wolfy-J) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Bootloader; | ||
|
||
use Spiral\DataGrid\Interceptor\GridInterceptor; | ||
use Spiral\Domain\CycleInterceptor; | ||
use Spiral\Domain\FilterInterceptor; | ||
use Spiral\Domain\GuardInterceptor; | ||
use Spiral\Keeper\Bootloader as Keeper; | ||
use Spiral\Keeper\Bootloader\KeeperBootloader; | ||
use Spiral\Keeper\Middleware\LoginMiddleware; | ||
|
||
class AdminBootloader extends KeeperBootloader | ||
{ | ||
protected const LOAD = [ | ||
Keeper\UIBootloader::class, | ||
Keeper\SitemapBootloader::class, | ||
Keeper\AnnotatedBootloader::class, | ||
]; | ||
|
||
protected const INTERCEPTORS = [ | ||
CycleInterceptor::class, | ||
GuardInterceptor::class, | ||
FilterInterceptor::class, | ||
GridInterceptor::class, | ||
]; | ||
|
||
protected const MIDDLEWARE = [ | ||
LoginMiddleware::class | ||
]; | ||
} |
Oops, something went wrong.