Skip to content

Instantly share code, notes, and snippets.

View mabasic's full-sized avatar
🏠
Working from home

Mario Bašić mabasic

🏠
Working from home
View GitHub Profile
@mabasic
mabasic / bookstore-advanced.apib
Created March 12, 2017 19:29
Advanced API Blueprint for Bookstore
FORMAT: 1A
# Bookstore Advanced
Bookstore is a simple API which allows consumers to view all books and create new ones.
## Data Structures
### Book
@mabasic
mabasic / articles.apib
Created March 19, 2017 20:18
API Blueprint for Laravel API 101 - DOCUMENT lesson
FORMAT: 1A
# Articles
Simple API for managing news articles.
## Authorization
To create, update or destroy an article, you have to authorize. To authorize you have to send your personal `api_token` key with the request in one of these three possible ways:
@mabasic
mabasic / environment.php
Last active December 20, 2019 02:47
Laravel - detectEnvironment
<?php
/*
|--------------------------------------------------------------------------
| Detect The Application Environment
|--------------------------------------------------------------------------
|
| Laravel takes a dead simple approach to your application environments
| so you can just specify a machine name for the host that matches a
| given environment, then we will automatically detect it for you.
@mabasic
mabasic / bookstore.apib
Created March 5, 2017 15:51
API Blueprint for Bookstore
FORMAT: 1A
# Bookstore
Bookstore is a simple API which allows consumers to view all books and create new ones.
## Group Book
Resources related to books in the API.
@mabasic
mabasic / User.php
Created September 26, 2016 11:58
Lumen app/User.php after implementing JWTSubject interface and methods.
<?php
namespace App;
use Illuminate\Auth\Authenticatable;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Tymon\JWTAuth\Contracts\JWTSubject;
@mabasic
mabasic / Envoy.blade.php
Last active December 20, 2019 02:48
Envoy common features
@servers(['web' => 'user@yourdomain.com -p 1234'])
@setup
$path = "/path/to/site";
@endsetup
@task('down')
cd {{ $path }}
php artisan down
@endtask
@mabasic
mabasic / NewRelicAppName.php
Created April 16, 2015 10:54
Add this to your PHP Application to set Application Name for New Relic monitoring.
/*
|--------------------------------------------------------------------------
| New Relic App Name
|--------------------------------------------------------------------------
|
| If the extension `newrelic` is loaded then
| set the name of the app to something.
|
*/
@mabasic
mabasic / ArrayValidation.php
Last active December 20, 2019 02:48
Custom Array Validation for Laravel
<?php
class ArrayValidation extends Illuminate\Validation\Validator
{
public function validatePeriodArray($field, $values, $params)
{
$valid = true;
foreach($values as $value)
{
@mabasic
mabasic / auth.php
Created September 26, 2016 11:01
`config/auth.php` for JWT Authentication in Lumen
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
@mabasic
mabasic / Envoy.blade.php
Last active June 5, 2023 05:01
Envoy common features with Slack notifications. See http://laravel.com/docs/5.0/envoy for more info.
@servers(['web' => 'username@domain.com -p 1234'])
@setup
$project_name = 'Project Name';
$project_url = 'http://project-domain.com/';
$project_root = '/www/project/web';
$slack_hook = 'your-slack-hook-url';
$slack_channel = '#channel';
@endsetup