承接 lukman-ss/intisari 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lukman-ss/intisari

Composer 安装命令:

composer require lukman-ss/intisari

包简介

The core PHP framework engine of Intisari.

README 文档

README

IntisariPHP is a framework core package for building small PHP applications. It provides the core application object and integrates routing, HTTP responses, configuration, views, database access, validation, console commands, middleware, exception handling, helpers, and testing utilities.

This package is the framework core only. The starter project skeleton is separate and is not created inside this package.

Requirements

  • PHP 8.2 or higher

Installation

composer require lukman-ss/intisari

Minimal Application

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use Intisari\Application;

$app = new Application(__DIR__);

$app->get('/', function () {
    return 'Hello IntisariPHP';
});

$app->run();

GET Route

use Intisari\Application;
use Lukman\Http\Request;

$app = new Application(__DIR__);

$app->get('/hello', function () {
    return 'Hello';
});

$response = $app->handle(new Request('GET', '/hello'));

Global Middleware

use Intisari\Application;
use Lukman\Http\MiddlewareInterface;
use Lukman\Http\Request;
use Lukman\Http\RequestHandlerInterface;
use Lukman\Http\Response;

final class AddHeaderMiddleware implements MiddlewareInterface
{
    public function process(Request $request, RequestHandlerInterface $handler): Response
    {
        return $handler->handle($request)->header('X-App', 'Intisari');
    }
}

$app = new Application(__DIR__);
$app->middleware(AddHeaderMiddleware::class);

Config Load

use Intisari\Application;

$app = new Application(__DIR__);
$app->loadConfiguration(__DIR__ . '/config');

$name = $app->config()->get('app.name', 'Intisari');

View Render

use Intisari\Application;

$app = new Application(__DIR__);
$app->config()->set('view.paths', [__DIR__ . '/resources/views']);

$html = $app->render('home', ['name' => 'Lukman']);

For home, create resources/views/home.php:

<h1>Hello, <?= $name ?></h1>

SQLite Database

use Intisari\Application;

$app = new Application(__DIR__);

$app->config()->set('database.connections', [
    'sqlite' => [
        'driver' => 'sqlite',
        'database' => ':memory:',
    ],
]);
$app->config()->set('database.default', 'sqlite');

$db = $app->db();
$db->statement('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)');
$db->affectingStatement('INSERT INTO users (name) VALUES (?)', ['Lukman']);

$users = $db->select('SELECT * FROM users');

Validation

use Intisari\Application;
use Lukman\Validation\Exception\ValidationException;

$app = new Application(__DIR__);

try {
    $validated = $app->validate(
        ['email' => 'demo@example.com'],
        ['email' => 'required']
    );
} catch (ValidationException $e) {
    $errors = $e->errors();
}

Console Command

use Intisari\Application;
use Lukman\Console\Command;
use Lukman\Console\Input;
use Lukman\Console\Output;

$app = new Application(__DIR__);

$app->command('hello', function (Input $input, Output $output): int {
    $output->writeln('Hello console');

    return Command::SUCCESS;
}, 'Print hello');

$exitCode = $app->runConsole();

Exception Debug

use Intisari\Application;
use Lukman\Http\Request;

$app = new Application(__DIR__);
$app->debug(true);

$response = $app->handle(new Request('GET', '/missing-route'));

When debug is enabled, exception responses include more detail. When debug is disabled, framework exceptions return concise HTTP responses.

Testing Utilities

use Intisari\Application;
use Lukman\Http\Request;

$app = new Application(__DIR__);
$app->get('/health', fn () => 'OK');

$app->test(new Request('GET', '/health'))
    ->assertStatus(200)
    ->assertSee('OK');

Helpers

Optional helper functions are loaded by Composer:

use Intisari\Application;

$app = new Application(__DIR__);
$app->setAsGlobal();

$value = config('app.name', 'Intisari');
$html = view('home', ['name' => 'Lukman']);
$response = response('OK');
$redirect = redirect('/login');

Tests

composer test

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固