Skip to content

Instantly share code, notes, and snippets.

View devkabir's full-sized avatar
🎯
Focusing

Dev Kabir devkabir

🎯
Focusing
  • Dhaka
View GitHub Profile
<?php
namespace CoiSA\Facade;
abstract class AbstractFacade implements FacadeInterface
{
use FacadeTrait;
}
<?php
trait Singleton
{
private static $instance;
public static function getInstance(...$args): static
{
if (null === self::$instance) {
self::$instance = new static(...$args);
<?php
// Save referrer url in cookie
function set_referrer_cookie() {
$cookie_value = $_SERVER['HTTP_REFERER'] ?? null; // Get URL the user came to your site for
if ( !is_admin() && !isset($_COOKIE['origin'])) { // If not an admin or if cookie doesn't exist already
setcookie( 'origin', $cookie_value, time()+3600*24*30, COOKIEPATH, COOKIE_DOMAIN, false); // Set cookie for 30 days
}
}
@wimvds
wimvds / test-composer-project-locally.md
Last active August 12, 2024 16:46
Test an existing composer project (create-project) locally

First, clone the repository of the project :

  mkdir /tmp/project-name
  git clone ...

Create a packages.json file in the root, containing the following :