This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command
$ docker-compose up -d
# To Tear Down
$ docker-compose down --volumes
| import { BASE_PATH, RESPONSE_OK } from '../../constants/Api'; | |
| import axios from 'axios'; | |
| export default class AbstractApi { | |
| constructor() { | |
| this.api = axios; | |
| this.path = ''; | |
| this.data = {}; | |
| } |
| <?php | |
| namespace App\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Http\Response; | |
| /** | |
| * Basic Auth / Basic認証の処理 | |
| */ |
| <?php | |
| # CUSTOM DAILY LOG | |
| // $app->configureMonologUsing(function($monolog) use ($app) { | |
| // $monolog->pushHandler( | |
| // (new Monolog\Handler\RotatingFileHandler( | |
| // // Set the log path | |
| // $app->storagePath().'/logs/app_error.log', | |
| // // Set the number of daily files you want to keep | |
| // $app->make('config')->get('app.log_max_files', 30) | |
| // ))->setFormatter(new Monolog\Formatter\LineFormatter(null, null, true, true)) |
| <?php | |
| $strCsvFilePath = DIR_CSV . $strCsvFileName; // SaveDir | |
| $strCsvDownloadUrl = URL_HOST . 'csv/' . $strCsvFileName; // Download Url | |
| mb_language("Japanese"); | |
| // Header | |
| $strCsvFileText = file_get_contents($strCsvFilePath); | |
| $from_encoding = CSV_ENCODE_AFTER; |
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "description": "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", | |
| "version": "1.0.0", | |
| "title": "Swagger Petstore", | |
| "termsOfService": "http://swagger.io/terms/", | |
| "contact": { | |
| "email": "[email protected]" | |
| }, |
| FROM php:7.0.4-fpm | |
| RUN apt-get update && apt-get install -y libmcrypt-dev \ | |
| mysql-client libmagickwand-dev --no-install-recommends \ | |
| && pecl install imagick \ | |
| && docker-php-ext-enable imagick \ | |
| && docker-php-ext-install mcrypt pdo_mysql |
| <?php | |
| // https://www.youtube.com/watch?v=zST3gGvnoww | |
| //https://medium.com/@dinotedesco/laravel-api-resources-what-if-you-want-to-manipulate-your-models-before-transformation-8982846ad22c | |
| // Routes | |
| $app->get('products', 'ProductsController@index'); | |
| $app->get('products/{id}', 'ProductsController@show'); | |
| $app->put('products/{id}', 'ProductsController@update'); | |
| $app->post('products', 'ProductsController@store'); |
| <?php | |
| $user = factory(User::class)->create([ | |
| 'email' => '[email protected]', | |
| 'password' => bcrypt('toptal123'), | |
| ]); | |
| $payload = ['email' => '[email protected]', 'password' => 'toptal123']; | |
| // 1 | |
| $this->json('POST', 'api/login', $payload) |
| 200: OK. The standard success code and default option. | |
| 201: Object created. Useful for the store actions. | |
| 204: No content. When an action was executed successfully, but there is no content to return. | |
| 206: Partial content. Useful when you have to return a paginated list of resources. | |
| 400: Bad request. The standard option for requests that fail to pass validation. | |
| 401: Unauthorized. The user needs to be authenticated. | |
| 403: Forbidden. The user is authenticated, but does not have the permissions to perform an action. | |
| 404: Not found. This will be returned automatically by Laravel when the resource is not found. | |
| 500: Internal server error. Ideally you're not going to be explicitly returning this, but if something unexpected breaks, this is what your user is going to receive. | |
| 503: Service unavailable. Pretty self explanatory, but also another code that is not going to be returned explicitly by the application. |