Skip to content

Commit

Permalink
Code Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Glenn Eggeton committed Oct 28, 2017
1 parent b5712e6 commit c2efc30
Show file tree
Hide file tree
Showing 28 changed files with 21,428 additions and 19,861 deletions.
4 changes: 2 additions & 2 deletions cli/newUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

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

$app = new App();
$app = new App();
$container = $app->getContainer();
$repo = $container->get(UserRepository::class);
$repo = $container->get(UserRepository::class);

$user = new User(
$argv[1],
Expand Down
73 changes: 44 additions & 29 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
{
"require": {
"slim/slim": "^3.8",
"slim/twig-view": "^2.3",
"php-di/slim-bridge": "^1.0",
"doctrine/orm": "^2.5",
"vlucas/phpdotenv": "^2.4",
"ramsey/uuid-doctrine": "^1.4",
"mailgun/mailgun-php": "^2.3",
"php-http/curl-client": "^1.7",
"guzzlehttp/psr7": "^1.4",
"paragonie/random_compat": "^2.0"
},
"require-dev" : {
"phpunit/phpunit" : "^5.6"
},
"scripts" : {
"gulp": "cd public/assets && npm install && gulp",
"post-install-cmd": "@gulp",
"db" : "vendor/bin/doctrine orm:schema-tool:update --force"
},
"autoload" : {
"psr-4" : {
"MyApp\\" : "src"
}
},
"autoload-dev" : {
"psr-4" : {
"MyApp\\Tests\\" : "tests"
}
"name": "geggleto/skelly",
"type": "library",
"description": "Skelly is a PHP Skeleton Project aimed at getting an MVP up and running quickly",
"keywords": [
"framework",
"bootstrap"
],
"license": "MIT",
"authors": [
{
"name": "Glenn Eggleton",
"email": "[email protected]",
"homepage": "https://glenneggleton.com"
}
],
"require": {
"slim/slim": "^3.8",
"slim/twig-view": "^2.3",
"php-di/slim-bridge": "^1.0",
"doctrine/orm": "^2.5",
"vlucas/phpdotenv": "^2.4",
"ramsey/uuid-doctrine": "^1.4",
"mailgun/mailgun-php": "^2.3",
"php-http/curl-client": "^1.7",
"guzzlehttp/psr7": "^1.4",
"paragonie/random_compat": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^5.6"
},
"scripts": {
"gulp": "cd public/assets && npm install && gulp",
"post-install-cmd": "@gulp",
"db": "vendor/bin/doctrine orm:schema-tool:update --force"
},
"autoload": {
"psr-4": {
"MyApp\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"MyApp\\Tests\\": "tests"
}
}
}
31 changes: 13 additions & 18 deletions config/di-container.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php

use function Clue\StreamFilter\fun;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Setup;
use Mailgun\Mailgun;
Expand All @@ -10,13 +9,12 @@

return [
'settings.displayErrorDetails' => true,
'doctrine.paths' => [
__DIR__.'/../src/Models/Authentication/Entities'
'doctrine.paths' => [
__DIR__ . '/../src/Models/Authentication/Entities',
],
'mailgun.domain' => 'mg.glenneggleton.com',
'email.domain' => 'http://admin.local',
EntityManager::class => function (ContainerInterface $container)
{
'mailgun.domain' => 'mg.glenneggleton.com',
'email.domain' => 'http://admin.local',
EntityManager::class => function (ContainerInterface $container) {
$entityManager = null;

$config = Setup::createAnnotationMetadataConfiguration(
Expand All @@ -30,19 +28,19 @@
$config->setAutoGenerateProxyClasses(true);


$file = __DIR__ . '/doctrine.php';
$file = __DIR__ . '/doctrine.php';
$dbConfig = include $file;

$entityManager = EntityManager::create($dbConfig, $config);
$platform = $entityManager->getConnection()->getDatabasePlatform();
$platform = $entityManager->getConnection()->getDatabasePlatform();
$platform->registerDoctrineTypeMapping('enum', 'string');

return $entityManager;
},
\Slim\Views\Twig::class => function (ContainerInterface $container) {
\Slim\Views\Twig::class => function (ContainerInterface $container) {
$view = new \Slim\Views\Twig(__DIR__ . '/../templates', [
'cache' => false,
'debug' => true
'debug' => true,
]);

// Instantiate and add Slim specific extension
Expand All @@ -54,17 +52,14 @@

return $view;
},
Mailgun::class => function (ContainerInterface $container)
{
Mailgun::class => function (ContainerInterface $container) {
return Mailgun::create($_ENV['MAILGUN']);
},
MailGunAdapter::class => function (ContainerInterface $container)
{
MailGunAdapter::class => function (ContainerInterface $container) {
return new MailGunAdapter($container->get('mailgun.domain'), $container->get(Mailgun::class));
},
MailService::class => function (ContainerInterface $container)
{
MailService::class => function (ContainerInterface $container) {
return $container->get(MailGunAdapter::class);
}
},
];

12 changes: 6 additions & 6 deletions config/doctrine.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
\Doctrine\DBAL\Types\Type::addType('uuid', 'Ramsey\Uuid\Doctrine\UuidType');

return [
'driver' => 'pdo_mysql',
'user' => $_ENV['DOCTRINE_USERNAME'],
'driver' => 'pdo_mysql',
'user' => $_ENV['DOCTRINE_USERNAME'],
'password' => $_ENV['DOCTRINE_PASSWORD'],
'dbname' => $_ENV['DOCTRINE_DATABASE'],
'host' => $_ENV['DOCTRINE_HOST'],
'charset' => 'utf8',
'port' => $_ENV['DOCTRINE_PORT']
'dbname' => $_ENV['DOCTRINE_DATABASE'],
'host' => $_ENV['DOCTRINE_HOST'],
'charset' => 'utf8',
'port' => $_ENV['DOCTRINE_PORT'],
];
2 changes: 1 addition & 1 deletion config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$this->get('/profile', ShowProfile::class);

$this->group('/api', function () {
$this->put('/profile', UpdateUser::class);
$this->put('/profile', UpdateUser::class);
});
})->add(SecurityMiddleware::class);

Expand Down
Loading

0 comments on commit c2efc30

Please sign in to comment.