Skip to content

Commit

Permalink
feat(Laravel): add framework + initial setup
Browse files Browse the repository at this point in the history
- PHP CS Fixer
- Package dependencies (Composer)
- Pre commit script
- .env
- etc
  • Loading branch information
quetzyg committed Apr 6, 2019
1 parent 3a92e4d commit 9f13b19
Show file tree
Hide file tree
Showing 66 changed files with 7,803 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_size = 2
36 changes: 36 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
APP_NAME="VOST Portugal API"
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=vost_api
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* text=auto
*.css linguist-vendored
*.scss linguist-vendored
*.js linguist-vendored
CHANGELOG.md export-ignore
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/coverage
/node_modules
/public/hot
/public/storage
/storage/*.key
/vendor
/.idea
/.vscode
/.php_cs.cache
.DS_Store
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
48 changes: 48 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'psr4' => true,
'strict_param' => true,
'declare_strict_types' => true,
'fully_qualified_strict_types' => true,
'single_quote' => true,
'linebreak_after_opening_tag' => true,
'logical_operators' => true,
'lowercase_cast' => true,
'short_scalar_cast' => true,
'no_whitespace_in_blank_line' => true,
'no_unused_imports' => true,
'combine_consecutive_issets' => true,
'not_operator_with_successor_space' => true,
'combine_consecutive_unsets' => true,
'native_function_casing' => true,
'native_function_invocation' => true,
'no_alias_functions' => true,
'trailing_comma_in_multiline_array' => true,
'mb_str_functions' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
],
'return_type_declaration' => [
'space_before' => 'none',
],
'class_attributes_separation' => [
'elements' => [
'method',
'property',
],
],
'binary_operator_spaces' => [
'default' => 'align_single_space_minimal',
],
'array_syntax' => [
'syntax' => 'short',
],
'concat_space' => [
'spacing' => 'none',
],
]);
37 changes: 37 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* {@inheritDoc}
*/
protected $commands = [
//
];

/**
* {@inheritDoc}
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}

/**
* {@inheritDoc}
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
19 changes: 19 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
/**
* {@inheritDoc}
*/
public function render($request, Exception $exception)
{
return parent::render($request, $exception);
}
}
16 changes: 16 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;

abstract class Controller
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
}
48 changes: 48 additions & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel
{
/**
* {@inheritDoc}
*/
protected $middleware = [
Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
Middleware\TrustProxies::class,
];

/**
* {@inheritDoc}
*/
protected $middlewareGroups = [
'web' => [],

'api' => [
'throttle:60,1',
'bindings',
],
];

/**
* {@inheritDoc}
*/
protected $routeMiddleware = [
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];

/**
* {@inheritDoc}
*/
protected $middlewarePriority = [
\Illuminate\Routing\Middleware\SubstituteBindings::class,
];
}
17 changes: 17 additions & 0 deletions app/Http/Middleware/CheckForMaintenanceMode.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;

class CheckForMaintenanceMode extends Middleware
{
/**
* {@inheritDoc}
*/
protected $except = [
//
];
}
18 changes: 18 additions & 0 deletions app/Http/Middleware/TrimStrings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;

class TrimStrings extends Middleware
{
/**
* {@inheritDoc}
*/
protected $except = [
'password',
'password_confirmation',
];
}
21 changes: 21 additions & 0 deletions app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Http\Middleware;

use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
{
/**
* {@inheritDoc}
*/
protected $proxies = '*';

/**
* {@inheritDoc}
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
40 changes: 40 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
use Notifiable;

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];

/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];

/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
28 changes: 28 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace VOSTPT\API\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
* {@inheritDoc}
*/
public function register()
{
//
}

/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
Loading

0 comments on commit 9f13b19

Please sign in to comment.