Skip to content

Instantly share code, notes, and snippets.

View vicentimartins's full-sized avatar

Vicente Martins vicentimartins

View GitHub Profile
### Stage 1: Base PHP ###
FROM php:7.4-fpm-alpine as php
COPY --from=composer /usr/local/bin /usr/local/bin/
RUN apk add --update \
curl-dev \
libcurl \
libpng \
freetype \
@vicentimartins
vicentimartins / docker-compose.yml
Last active November 26, 2020 20:30
Xdebug on VSCode using docker
version; '3.7'
services:
php:
volumes:
- ...
other_settings:
- ...
enviroment:
...
@vicentimartins
vicentimartins / nginx.conf
Created April 30, 2021 20:02
Configuração nginx
server {
listen 80;
server_name localhost;
root /var/www/symfony/public;
location /api-docs/ {
}
location / {
@vicentimartins
vicentimartins / php_from_docker.sh
Last active April 16, 2022 19:55
Run php without php installed at localhost
#!/bin/sh
docker run --network host --rm -e HOME="$HOME" -u "$(id -u)":"$(id -g)" -v "$HOME":"$HOME" -w "$PWD" php:8.1-fpm php "$@"
exit $?
public function rules(): array
{
return [
'password' => [
'required',
Password::min(8)->letters()->numbers()->mixedCase()
],
'password_confirm' => [
'same:password',
'required',
@vicentimartins
vicentimartins / Repository.php
Last active June 30, 2022 22:09
Teste de repository
// $query é um Eloquent\Builder
$query = parent::newQuery();
$query->with('relation') // with() é um método de Eloquent\Builder
->join( // join() é método de Query\Builder
'table2',
'table1.user_id',
'table2.another_user_id'
)
->where('table2.another_user_id', $parametro); // where() está em ambos, Query\Builder e Eloquent\Builder