PHP code example of leearvin / hyperf-tinker

1. Go to this page and download the library: Download leearvin/hyperf-tinker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

leearvin / hyperf-tinker example snippets

bash
php bin/hyperf.php vendor:publish leearvin/hyperf-tinker
bash
php bin/hyperf.php tinker
bash
➜  t.hyperf.com git:(master) ✗ php bin/hyperf.php tinker
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Paginator\Listener\PageResolverListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener.
Psy Shell v0.10.4 (PHP 7.2.34 — cli) by Justin Hileman
Unable to check for updates
>>> $user = App\Model\User::find(1)
[DEBUG] Event Hyperf\Database\Model\Events\Booting handled by Hyperf\ModelListener\Listener\ModelHookEventListener listener.
[DEBUG] Event Hyperf\Database\Model\Events\Booting handled by Hyperf\ModelListener\Listener\ModelEventListener listener.
[DEBUG] Event Hyperf\Database\Model\Events\Booted handled by Hyperf\ModelListener\Listener\ModelHookEventListener listener.
[DEBUG] Event Hyperf\Database\Model\Events\Booted handled by Hyperf\ModelListener\Listener\ModelEventListener listener.
[DEBUG] Event Hyperf\Database\Events\QueryExecuted handled by App\Listener\DbQueryExecutedListener listener.
[DEBUG] Event Hyperf\Database\Model\Events\Retrieved handled by Hyperf\ModelListener\Listener\ModelHookEventListener listener.
[DEBUG] Event Hyperf\Database\Model\Events\Retrieved handled by Hyperf\ModelListener\Listener\ModelEventListener listener.
=> App\Model\User {#81816
     +incrementing: true,
     +exists: true,
     +wasRecentlyCreated: false,
     +timestamps: true,
   }
>>> var_dump($user)
object(App\Model\User)#81816 (28) {
  ["table":protected]=>
  string(5) "users"
  ["fillable":protected]=>
  array(2) {
    [0]=>
    string(2) "id"
    [1]=>
    string(4) "name"
  }
  ["casts":protected]=>
  array(0) {
  }
  ["incrementing"]=>
  bool(true)
  ["exists"]=>
  bool(true)
 
  ["attributes":protected]=>
  array(4) {
    ["id"]=>
    int(1)
    ["name"]=>
    string(5) "arvin"
    ["created_at"]=>
    string(19) "2020-11-23 18:38:00"
    ["updated_at"]=>
    string(19) "2020-11-23 18:38:03"
  }
  ["original":protected]=>
  array(4) {
    ["id"]=>
    int(1)
    ["name"]=>
    string(5) "arvin"
    ["created_at"]=>
    string(19) "2020-11-23 18:38:00"
    ["updated_at"]=>
    string(19) "2020-11-23 18:38:03"
  }
  
}
=> null
bash
>>> doc md5
function md5($str, $raw_output = unknown)

PHP manual not found
    To document core PHP functionality, download the PHP reference manual:
    https://github.com/bobthecow/psysh/wiki/PHP-manual
>>>