Skip to content

Instantly share code, notes, and snippets.

@tattali
tattali / GeoIP2 Symfony.md
Created January 29, 2023 16:37
Easy install of GeoIP2 with Symfony
@tattali
tattali / Api Platform + GraphQL + Apollo + TypeScript.md
Last active January 2, 2022 16:43
Api Platform + GraphQL + Apollo + TypeScript

Api Platform + GraphQL + Apollo + TypeScript

Symfony | Api Platform | GraphQL | Apollo | TypeScript | React Hooks

Backend

Install Api Platform

composer req api
@tattali
tattali / Create or Get UTM Cookies with Symfony.md
Last active May 24, 2020 08:06
Create or Get UTM Cookies with Symfony

Create or Get UTM Cookies with Symfony

The UtmCookieBundle allow you to save utm parameters from url into a cookie. It's also provide a bunch of tools to easily retrive all or each utm.

  • Work with any flex Symfony projects 3.4+ to 5.0+
  • PHP v7.1+

Installation

Download tattali/utm-cookie-bundle using composer

@tattali
tattali / react-context.md
Last active July 12, 2022 08:29
How to share data between components with react context

React Context as a store

TYPESCRIPT | useState

Context configuration

// src/services/context/StoreContext.tsx
import React, { createContext, Dispatch, PropsWithChildren, SetStateAction, useState } from "react";

export interface IStore {
  props1: string;
@tattali
tattali / Use fullcalendar.js library in your Symfony project with doctrine.md
Last active August 5, 2023 10:53
Use fullcalendar.js library in your Symfony project with doctrine

Use fullcalendar.js library in your Symfony 4 project with doctrine

FullCalendar.js is a JavaScript event calendar customizable and open source. You can display a full-size event calendar that also compatible with google calendar.

Installation

Download tattali/CalendarBundle using composer

$ composer require tattali/calendar-bundle
@tattali
tattali / bootstrap-4-nav-collapse.md
Last active June 13, 2018 10:01
Bootstrap 4 nav collapse

No theme

<ul id="accordionExample">
  <li data-toggle="collapse" data-target="#collapseOne">
    Lvl 1
    <ul id="collapseOne" class="collapse show" data-parent="#accordionExample">
      <li>Lvl 1.1</li>
      <li>Lvl 1.2</li>
    </ul>
  </li>

Symfony 4 CRUD best practices

Step by step

Two shots CRUD packages installation

composer require --dev sec-checker profiler server
composer require annotations twig asset translator form doctrine validator

Symfony 4

Framework download and install

Install Symfony 4 skeleton

composer create-project symfony/skeleton my-project && cd my-project

Use git to versionize your project

Mettre en production un projet Symfony 4 sur un VPS OVH

VPS OVH | Ubuntu 16.04.3 LTS | LAMP | SYMFONY 4

Pré-requis

  • Votre projet doit être versionné avec git et hébergé (Github, Bitbucket...).
  • Vous devez avoir acheté un VPS et un nom de domaine.
  • Vous devez également générer une clé SSH sur votre ordinateur. (explications ci-dessous)

Création et ajout de la clé SSH au profil OVH

Mac OS X

Icons trouble

sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder