PHP code example of aimanong / thinkphp

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

    

aimanong / thinkphp example snippets


return [
    \Aimanong\ThinkPHP\ThinkService::class,   // ← 必须第一项
    \app\YourService::class,
];

namespace app;

use Aimanong\Resource;

class CustomerResource extends Resource
{
    public static function model(): string { return Customer::class; }
    public static function label(): string { return '客户'; }
    public static function uri(): string   { return 'customers'; }

    public static function grid(\Aimanong\Grid\Grid $grid): void
    {
        $grid->column('id', 'ID')->sortable();
        $grid->column('name', '名称')->searchable();
    }

    public static function form(\Aimanong\Form\Form $form): void
    {
        $form->text('name')->label('名称')->

use Aimanong\Aimanong;

public function register(): void
{
    Aimanong::registry()->register(CustomerResource::class);
}

// config/aimanong.php —— 与 Laravel 侧**结构完全相同**
'applications' => [
    'admin' => ['title' => '总管理后台', 'route' => ['prefix' => 'admin'], 'auth' => ['guard' => 'admin', 'model' => \Aimanong\ThinkPHP\Models\Administrator::class]],
    'agent' => ['title' => '代理商后台', 'route' => ['prefix' => 'agent'], 'auth' => ['guard' => 'agent', 'model' => \app\Agent::class]],
],
bash
php think aimanong:install --admin-user=admin --admin-password=你的密码
php think aimanong:schema     # 生成四份产物
php think ai:verify           # 校验声明