Skip to content

Commit

Permalink
ADD: Console Application && Dump Versions
Browse files Browse the repository at this point in the history
  • Loading branch information
gravataLonga committed Dec 14, 2022
1 parent 0f80cf3 commit 24c1cd3
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 5 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "project",
"require": {
"php": "^8.1",
"gravatalonga/king-foundation": "^1.0",
"gravatalonga/king-foundation": ">=1.0.10",
"middlewares/whoops": "^2.0",
"doctrine/migrations": "^3.5"
},
Expand Down
15 changes: 14 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@
declare(strict_types=1);

return [

/**
* Name of Application
*/
'name' => $_ENV['APP_NAME'] ?? 'APP',

/**
* Version of Application
*/
'version' => $_ENV['VERSION'] ?? '1.0.0',

/**
* Env of Application
*/
'env' => $_ENV['APP_ENV'] ?? 'local',

/**
* Enable Debug
*/
'debug' => $_ENV['APP_DEBUG'] ?? false,
];
4 changes: 4 additions & 0 deletions config/commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
declare(strict_types=1);

return [
/**
* Here is where command bus pattern ground base.
* You can provider Command::class => Handler::class pattern can be define.
*/
];
9 changes: 9 additions & 0 deletions config/console.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

return [
/**
* Here we can add our commands to console application
* 'app:debug' => AppDebugCommand::class
* **Note**: You need to bind AppDebugCommand::class also to container.
*/
];
2 changes: 2 additions & 0 deletions config/providers.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use Gravatalonga\KingFoundation\CommandBusServiceProvider;
use Gravatalonga\KingFoundation\ConsoleServiceProvider;
use Gravatalonga\KingFoundation\DatabaseServiceProvider;
use Gravatalonga\KingFoundation\LogServiceProvider;
use Gravatalonga\KingFoundation\SlimServiceProvider;
Expand All @@ -17,5 +18,6 @@
new SlimServiceProvider(),
new DatabaseServiceProvider(),
new CommandBusServiceProvider(),
new ConsoleServiceProvider(),
new TwigServiceProvider()
];
13 changes: 13 additions & 0 deletions console
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env php
<?php
// application.php

require __DIR__.'/vendor/autoload.php';

use Symfony\Component\Console\Application;

$kernel = require_once "bootstrap/bootstrap.php";

$application = \Gravatalonga\Framework\instance(Application::class);

$application->run();
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
/**
* @var \Gravatalonga\KingFoundation\Kernel $app
*/
$app = require_once "bootstrap.php";
$app = require_once "../bootstrap/bootstrap.php";

$app->run();
2 changes: 1 addition & 1 deletion tests/CreateApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ trait CreateApplication
{
public function createApplication()
{
$this->app = require_once __DIR__ . "/../public/bootstrap.php";
$this->app = require_once __DIR__ . "/../bootstrap/bootstrap.php";
}
}
3 changes: 2 additions & 1 deletion tests/HelloWorldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Tests;

use Gravatalonga\KingFoundation\Kernel;
use Gravatalonga\KingFoundation\Testing\InteractHttp;
use Gravatalonga\KingFoundation\Testing\TraitRequest;
use Slim\Psr7\Request;
use Slim\Psr7\Response;
Expand All @@ -14,7 +15,7 @@
*/
class HelloWorldTest extends TestCase
{
use TraitRequest;
use InteractHttp;

public function setUp(): void
{
Expand Down

0 comments on commit 24c1cd3

Please sign in to comment.