-
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
Showing
5 changed files
with
141 additions
and
7,000 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 |
---|---|---|
@@ -1,12 +1,101 @@ | ||
# Keeper demo | ||
# Spiral Keeper Application Skeleton [![Latest Stable Version](https://poser.pugx.org/spiral/app-keeper/version)](https://packagist.org/packages/spiral/app-keeper) | ||
|
||
Install: | ||
<img src="https://user-images.githubusercontent.com/796136/67560465-9d827780-f723-11e9-91ac-9b2fafb027f2.png" height="135px" alt="Spiral Framework" align="left"/> | ||
|
||
Spiral Framework makes developing in PHP exciting again. It optimizes on the power of PHP to quickly develop business logic while uniquely leveraging Golang to craft an elegant infrastructure layer with native support for HTTP/2, GRPC, Queue, and more. Build faster, more efficient applications with this flexible and PSR compliant PHP7 framework (and have fun while you’re at it). | ||
|
||
[App Skeleton](https://github.com/spiral/app) ([CLI](https://github.com/spiral/app-cli), [GRPC](https://github.com/spiral/app-grpc)) | [**Documentation**](https://spiral.dev/docs) | [Twitter](https://twitter.com/spiralphp) | [CHANGELOG](/CHANGELOG.md) | [Contributing](https://github.com/spiral/guide/blob/master/contributing.md) | ||
|
||
<br/> | ||
|
||
Server Requirements | ||
-------- | ||
Make sure that your server is configured with following PHP version and extensions: | ||
* PHP 7.2+, 64bit | ||
* *mb-string* extension | ||
* PDO Extension with desired database drivers (default SQLite) | ||
|
||
Application Bundle | ||
-------- | ||
Application bundle includes the following components: | ||
* High-performance HTTP, HTTP/2 server based on [RoadRunner](https://roadrunner.dev) | ||
* Console commands via Symfony/Console | ||
* Translation support by Symfony/Translation | ||
* Queue support for AMQP, Beanstalk, Amazon SQS, in-Memory | ||
* Stempler template engine | ||
* Security, validation, filter models | ||
* PSR-7 HTTP pipeline, session, encrypted cookies | ||
* DBAL and migrations support | ||
* Monolog, Dotenv | ||
* Prometheus metrics | ||
* [Cycle DataMapper ORM](https://github.com/cycle) | ||
* Keeper Admin panel | ||
|
||
Installation | ||
-------- | ||
``` | ||
composer create-project spiral/app-keeper | ||
``` | ||
|
||
> Application server will be downloaded automatically (`php-curl` and `php-zip` required). | ||
Once the application is installed you can ensure that it was configured properly by executing: | ||
|
||
``` | ||
$ php app.php configure | ||
``` | ||
|
||
Seed user accounts: | ||
|
||
``` | ||
$ php app.php user:seed | ||
``` | ||
|
||
Create super admin account: | ||
|
||
``` | ||
$ php app.php user:create {First-Name} {Last-Name} {email-address} {password} | ||
``` | ||
|
||
To start application server execute: | ||
|
||
``` | ||
$ ./spiral serve -v -d | ||
``` | ||
|
||
On Windows: | ||
|
||
``` | ||
$ spiral.exe serve -v -d | ||
``` | ||
|
||
Application will be available on `http://localhost:8080`. Keeper control panel available at `http://localhost:8080/keeper`. | ||
|
||
> Read more about application server configuration [here](https://roadrunner.dev/docs). | ||
Testing: | ||
-------- | ||
To test an application: | ||
|
||
```bash | ||
$ ./vendor/bin/phpunit | ||
``` | ||
|
||
Cloning: | ||
-------- | ||
Make sure to properly configure project if you cloned the existing repository. | ||
|
||
```bash | ||
$ composer install | ||
$ copy .env.sample .env | ||
$ php app.php encrypt:key -m .env | ||
$ php app.php configure -vv | ||
$ php app.php migrate:init | ||
$ php app.php migrate | ||
$ php app.php cycle | ||
$ php app.php configure | ||
$ php app.php user:seed | ||
$ ./vendor/bin/spiral get | ||
``` | ||
|
||
> Make sure to create super-admin account. | ||
License: | ||
-------- | ||
MIT License (MIT). Please see [`LICENSE`](./LICENSE) for more information. Maintained by [Spiral Scout](https://spiralscout.com). |
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
<?php | ||
|
||
/** | ||
* {project-name} | ||
* | ||
* @author {author-name} | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Command\User; | ||
|
||
use App\Database\User; | ||
use Spiral\Console\Command; | ||
use Spiral\Prototype\Traits\PrototypeTrait; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
class CreateCommand extends Command | ||
{ | ||
use PrototypeTrait; | ||
|
||
protected const NAME = 'user:create'; | ||
protected const DESCRIPTION = 'Create Super-Admin user'; | ||
protected const ARGUMENTS = [ | ||
['firstName', InputArgument::REQUIRED, 'First name'], | ||
['lastName', InputArgument::REQUIRED, 'Last name'], | ||
['email', InputArgument::REQUIRED, 'Email/Username'], | ||
['password', InputArgument::REQUIRED, 'Password'], | ||
]; | ||
|
||
/** | ||
* Perform command | ||
*/ | ||
protected function perform(): void | ||
{ | ||
$user = new User(); | ||
$user->firstName = $this->argument('firstName'); | ||
$user->lastName = $this->argument('lastName'); | ||
$user->email = $this->argument('email'); | ||
$user->passwordHash = $this->passwords->hash($this->argument('password')); | ||
$user->roles = 'super-admin'; | ||
|
||
$this->entities->save($user); | ||
} | ||
} |
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
Oops, something went wrong.