PHP code example of xiaobai / mph

1. Go to this page and download the library: Download xiaobai/mph 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/ */

    

xiaobai / mph example snippets


'amp' => \xiaobai\think\command\ModelProperty::class,

php think amp index/model #为index模块下model目录的所有的模型文件生成注释

php think amp index/model/PeopleModel.php #为index模块下model目录的PeopleModel生成注释

class PeopleModel extends Model
{
    protected $table = 'new_people';

    /**
     * 人物的工作经历数据
     * @return \think\model\relation\HasMany
     */
    public function careerData()
    {
        return $this->hasMany(CareerModel::class,'people_guid','guid');
    }

    /**
     * 个人的详细信息
     * @return \think\model\relation\HasOne
     */
    public function profileData()
    {
        return $this->hasOne(ProfileModel::class,'people_guid','guid');
    }

    /**
     * 头像的完整路径
     * @param $value
     * @param $data
     * @return mixed
     */
    public function getLogoFullPathAttr($value,$data)
    {
        return resource_url($data['urk']);
    }

}