PHP code example of hyperf-plus / core
1. Go to this page and download the library: Download hyperf-plus/core 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/ */
hyperf-plus / core example snippets
namespace YourApp\Model;
use HPlus\Core\Model\Model;
class YourModel extends Model
{
protected string $table = 'your_table';
protected array $fillable = ['field1', 'field2'];
}
use HPlus\Core\Exception\BusinessException;
// 抛出业务异常
throw new BusinessException('业务错误信息');
namespace YourApp\Service;
use HPlus\Core\Service\AbstractService;
class YourService extends AbstractService
{
public function doSomething()
{
// 业务逻辑
}
}