Skip to content

Instantly share code, notes, and snippets.

@mabasic
mabasic / articles.apib
Created Mar 19, 2017
API Blueprint for Laravel API 101 - DOCUMENT lesson
View articles.apib
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 / bookstore-advanced.apib
Created Mar 12, 2017
Advanced API Blueprint for Bookstore
View bookstore-advanced.apib
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 / bookstore.apib
Created Mar 5, 2017
API Blueprint for Bookstore
View bookstore.apib
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 Sep 26, 2016
Lumen app/User.php after implementing JWTSubject interface and methods.
View User.php
<?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 / auth.php
Created Sep 26, 2016
`config/auth.php` for JWT Authentication in Lumen
View auth.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
@mabasic
mabasic / helpers.php
Last active Apr 5, 2019
config_path function for Lumen framework
View helpers.php
<?php
if ( ! function_exists('config_path'))
{
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/
@mabasic
mabasic / Envoy.blade.php
Last active May 30, 2017
Envoy common features with Slack notifications. See http://laravel.com/docs/5.0/envoy for more info.
View Envoy.blade.php
@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
@mabasic
mabasic / Envoy.blade.php
Last active Jan 29, 2017
Envoy common features
View Envoy.blade.php
@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 Apr 16, 2015
Add this to your PHP Application to set Application Name for New Relic monitoring.
View NewRelicAppName.php
/*
|--------------------------------------------------------------------------
| 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 Aug 29, 2015
Custom Array Validation for Laravel
View ArrayValidation.php
<?php
class ArrayValidation extends Illuminate\Validation\Validator
{
public function validatePeriodArray($field, $values, $params)
{
$valid = true;
foreach($values as $value)
{
You can’t perform that action at this time.