Skip to content

Instantly share code, notes, and snippets.

View aliabbasi68's full-sized avatar
🎯
Focusing

ali abbasi shahkooh aliabbasi68

🎯
Focusing
  • shetabit
  • IRAN/Golestan province/Gorgan city
View GitHub Profile
@aligoren
aligoren / RouterProdiver.php
Last active March 6, 2019 06:19
Router Class
<?php
class Router {
public static function Map($method, $page, $closure) {
$reqMethod = $_SERVER['REQUEST_METHOD'] === strtoupper($method);
$reqPage = $_GET['params'] === ltrim($page, '/');
if($reqMethod and $reqPage) {
return (is_object($closure) && ($closure instanceof Closure)) ? $closure() : $closure;
}
}
@hamog
hamog / laravel_deploy.md
Last active September 10, 2019 13:38
Deploy laravel 5 application on shared hosting.

Deploy Laravel 5 application on shared hosting

Server Requirements (Laravel 5.4)

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension
@aligoren
aligoren / index.php
Created December 31, 2016 11:34
Get Base URL / Path with PHP
<?php
/*
It works these urls:
Without sub dir
http://site.com/index.php
http://site.com/index.php/
@aligoren
aligoren / db.php
Last active March 6, 2019 06:14
PHP Method Chaining with Database Sample.
<?php
class DB
{
private $select;
private $where;
private $where_and;
private $where_or;
public function select($select, $fields)
{
@SalvadorP
SalvadorP / l51_artisan_tinker_user_creation.sh
Last active November 19, 2020 17:11
Laravel 5.1 how to create a user using artisan tinker and the standard user model
php artisan tinker
$user = new App\User;
$user->name="Admin";
$user->email="[email protected]";
$user->password=bcrypt('1234');
$user->save();
<?php
/*
* Random Password Generator
* @param $olustur = new SifreOlusturucu(); or $olustur = new SifreOlusturucu(16);
* @param $olustur->sifreOlustur(); // output: wIsLiXzH1uP@hqSm
* @author Ali GOREN
* @copyright Ali GOREN
* @link http://blog.aligoren.net
* @package: SifreOlusturucu
@francescoagati
francescoagati / extensions.php
Created September 24, 2012 14:46
simple extension method with reflection and __call in php
<?php
class St {
public static function pippa($obj) {
print_r($obj);
}
}
@IsaacVanName
IsaacVanName / PHP Method Chaining from Constructor
Created December 23, 2010 17:39
PHP Method Chaining from Constructor
/*
new MyClass->my_method() isn't possible. However, there are a couple of solutions, of which the best seems to be the most unlikely as well.
****
Note: Make sure you read/skim to the end, even if you figure out the first solution quickly
(which you should). The second solution has a bit of brief research to go along with it! :-)
****
At times, it can be useful to have a class that maintains state long enough to complete a
cycle, but doesn't get stored in memory. No extra baggage needed, right?