Skip to content

Instantly share code, notes, and snippets.

View devLopez's full-sized avatar
🎯
Focusing

Matheus Lopes Santos devLopez

🎯
Focusing
View GitHub Profile
<?php
use SimpleXMLElement;
/**
* CaixaResponseReader
*
* Realiza o parsing do xml retornado pelo webservice da caixa
*
* @author Matheus Lopes Santos <[email protected]>
@devLopez
devLopez / README.md
Created July 10, 2018 19:18 — forked from emsifa/README.md
Laravel 5.1 Validation Outside Laravel

Laravel 5.1 Validation Outside Laravel

First you need to install illuminate/validation by typing this composer require illuminate/validation:5.1.*.

Then, you can use laravel validation like this:

$validatorFactory = new ValidatorFactory;

Configuração de subdomínios local (Apache + DNSmasq + Laravel)

Este tutorial tem como objetivo, a configuração do seu apache local para trabalhar com subdominios no laravel.

O que será utilizado:

  • Laravel
  • Servidor Apache
  • Servidor DNS/DHCP
  • Linux
@devLopez
devLopez / phpstorm-ajuste.sh
Created February 21, 2018 12:38 — forked from cagartner/phpstorm-ajuste.sh
Ajuste para acentos phpstorm
# Adicionar essa linha no arquivo phpstorm.sh da pasta do seu editor
export XMODIFIERS=""
<?php
return [
// Configuração da conexão padrão
'default' => env('DB_CONNECTION', 'firebird'),
// Configurações dos outros bancos de dados
// COnfiguração do firebird
'firebird' => [
@devLopez
devLopez / NewMessage.php
Created November 21, 2016 18:43 — forked from sebastiaanluca/NewMessage.php
Laravel + Redis + NodeJS + Socket.io pub/sub secure server and client supporting multiple rooms, channels, users, … Add `client.js` to your client app, run `node server.js`, and trigger the Laravel event any way you want to broadcast the data.
<?php
namespace App\Events;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Queue\SerializesModels;
class NewMessage extends Event implements ShouldBroadcast
{
#Configurações para retirar o index.php das urls, deixando-as mais amigáveis
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
@devLopez
devLopez / README.md
Created July 20, 2016 02:48
PHP: HTML to PDF conversion using wkhtmltopdf (and Smarty)

Recently I was asked to generate PDF invoices for an online shop. I looked at various PHP PDF generators, but wasn't particularly impressed with any of them.

Then I found (via Stack Overflow) a command-line HTML-to-PDF convertor called wkhtmltopdf, which uses WebKit (the same layout engine as Safari and Google Chrome) and therefore is very accurate.

There is a class for PHP integration on the Wiki, but I found it overly complicated and it uses temp files which aren't necessary. This is the code I wrote instead.

I used Smarty for generating the HTML for the PDF, but you can use any template engine, or pure PHP if you prefer.

Note: I originally tried to install wkhtmltopdf from source, but it's much easier to use the static binary instead.

@devLopez
devLopez / DatabaseConnectionTrait.php
Created June 29, 2016 13:29
Conexão dinâmica com bancos de dados
<?php namespace App\Traits\Db;
use Config;
/**
* DatabaseConnectionTrait
*
* Realiza a reconfiguração do banco de dados baseado no nome da conexão
* definido no model
*
@devLopez
devLopez / laravel.js
Last active December 5, 2017 16:06 — forked from JeffreyWay/laravel.js
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.)To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {