定制 c0pt3r/sonet 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

c0pt3r/sonet

Composer 安装命令:

composer require c0pt3r/sonet

包简介

!!WIP!! A simple framework for websites/web APIs

README 文档

README

A simple PHP framework for creating websites and/or web APIs.

It supports routing of HTTP requests with methods GET, POST, PUT and DELETE. Other things too... maybe one day I'll make a doc for it.

Main concepts:

This section is pretty much just a placeholder.

  • Application: A global container for all application data. Is also a Router itself (aka: main application router).
  • VirtualPath: An extended path that can contain variables, options and aliases.
  • Router: An object that contains Routes and is mounted to a VirtualPath. You can have as many as you want.
  • Route: An object created by a Router and mounted onto it.
  • StatusEvent: An event that is triggered when certain HTTP statuses are encountered.
  • Request: A predefined object that contains information about the requested resource.
  • Response: A predefined object that contains information about the response to be sent.
  • Handler: A user defined callable that accepts Request and Response as parameters. It can be assigned to a Route or a StatusEvent.

Example code:

This code creates a Route that will listen for a request using HTTP method GET.

$app = Sonet\Application::getApp();

$app->get('hello|h/?name', function ($req, $res) {
	$name = $req->params->name ?? 'world';
	$res->html("Hello, $name!");
});

$app->run();

This VirtualPath corresponds to:

  • /hello
  • /hello/([^/]+)
  • /h
  • /h/([^/]+)

For example,

  • /hello will generate "Hello, world!"
  • /h/Einstein will generate "Hello, Einstein!"

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-20