| Recommend this page to a friend! | 
|  Download | 
| Info | Documentation |  Files |  Install with Composer |  Download | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not enough user ratings | Total: 70 | All time:  10,298 This week: 39  | ||||
| Version | License | PHP version | Categories | |||
| has-parent 0.0.2 | GNU General Publi... | 5.6 | PHP 5, Language, Traits | 
This trait assigns parent to a class.
HasParent is open-sourced software licensed under the GPL-3.0.
Package depends on __deferred-exceptions__ package.
composer require seotils/has-parent
<?php
namespace My;
use Seotils\Traits\HasParent;
/
 * Parent class
 */
class A {
  public function time(){
    return date('Y-m-d H:i:s');
  }
}
/
 * Class with HasParent trait
 */
class B {
  use HasParent;
}
// Usage
$a = new A();
$b = new B();
// Assign and use parent class
echo $b->parentClass( $a )->time();
// Or step by step
// Assign parent class
$b->parentClass( $a );
// Use parent class
echo $b->parentClass()->time();
That`s all!
|  Files (5) | 
| File | Role | Description | ||
|---|---|---|---|---|
|  src (2 directories) | ||||
|    composer.json | Data | Auxiliary data | ||
|    LICENSE | Lic. | License text | ||
|    README.md | Doc. | Class source | ||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
|  Install with Composer | 
|  | has-parent-2022-10-21.zip 14KB | 
|  | has-parent-2022-10-21.tar.gz 13KB | 
|  | Install with Composer | 
| Needed packages | ||
| Class | Download | Why it is needed | Dependency | 
|---|---|---|---|
| Deferred Exceptions |  .zip  .tar.gz | It`s a part of the package | Required | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% | 
 | 
 | 
| Applications that use this package | 
 If you know an application of this package, send a message to the author to add a link here.
 If you know an application of this package, send a message to the author to add a link here.