Skip to content

Instantly share code, notes, and snippets.

@shmshd
shmshd / AppExtension.php
Created October 1, 2019 04:57
Using .env variables in Twig using custom Twig Extension
<?php
//src/Twig/AppExtension.php
namespace App\Twig;
use Twig\Extension\AbstractExtension;
use Twig\TwigFunction;
class AppExtension extends AbstractExtension
@shmshd
shmshd / move.php
Last active June 29, 2017 09:16 — forked from baamenabar/move.php
PHP move all files and folders from one directory to a new directory
<?php
$dir = "."; //path to backup
$dirNew = "move"; //path to move the destination
if(!file_exist($dirNew){
mkdir($dirNew, 0777, true); //create a new directory if not exist
}
// Open a known directory, and proceed to read its contents
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {