https://www.ibm.com/developerworks/library/os-php-designptrns/index.html

The factory pattern

<?php 
interface IUser{
  function getName();
}
 
class User implements IUser{
  public function __construct($id){}
 
  function getName(){
    return 'Jack';
  }
}
 
class UserFactory{
  public static function Create($id){
    return new User($id);
  }
}
 
$uo = UserFactory::Create(1);
echo $uo->getName();