Skip to content

Instantly share code, notes, and snippets.

View jilcimar's full-sized avatar
🎯
Focusing

Jilcimar Fernandes jilcimar

🎯
Focusing
View GitHub Profile
@jilcimar
jilcimar / FreightCalculate.php
Last active May 19, 2022 21:05
Obter frete dos correios usando PHP. #laravel #correios #php
<?php
//namespace ......;
class FreightCalculate
{
public function __construct(
private string $code, //41106 - PAC , 40010 - SEDEX
private string $originZipCode,
private string $destinationZipCode,
@jilcimar
jilcimar / Handler.php
Created November 10, 2021 01:26
Laravel Exception Json for API
public function render($request, Throwable $e)
{
if ($request->is('api/*')) { //add Accept: application/json in request
if($e instanceof ValidationException)
return response()->json($e->errors(),$e->status);
}
$retval = parent::render($request, $e);
return $retval;
}

SETUP LARAVEL + PHP (LINUX)

Lista de comandos para instalar e configurar o ambiente de desenvolvimento pusando o Laravel e PHP.

PHP 7.2

sudo apt install php7.2-cli php7.2 php7.2-pgsql php7.2-sqlite3 php7.2-gd php7.2-curl php-memcached php7.2-imap php7.2-mysql php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-soap php7.2-intl php7.2-readline php7.2-xml git libmcrypt4 libpcre3