定制 xp-framework/scriptlet 二次开发

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

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

xp-framework/scriptlet

最新稳定版本:v9.2.2

Composer 安装命令:

composer require xp-framework/scriptlet

包简介

Scriptlets for the XP Framework

关键字:

README 文档

README

Build Status on TravisCI XP Framework Module BSD Licence Required PHP 5.6+ Supports PHP 7.0+ Latest Stable Version

Everything that runs in the web in the XP Framework, is a scriptlet, at the beginning. Every higher-class API is derived from the simple HttpScriptlet class: RestScriptlet, WorkflowScriptlet, ...

The HttpScriptlet class

The scriptlet.HttpScriptlet class is the base class for any so-called scriptlet. A scriptlet is something that can serve HTTP requests.

The simplest form of answering an HTTP request in XP Framework goes like this:

namespace com\example\web; class HelloScriptlet extends \scriptlet\HttpScriptlet { /**  * Perform GET request  *  * @param scriptlet.Request $request  * @param scriptlet.Response $response  * @throws scriptlet.ScriptletException  */ public function doGet($request, $response) { $response->write(sprintf('<!DOCTYPE html>  <html>  <head><title>Hello World scriptlet</title></head>  <body>  <h1>Hello %s</h1>  </body>  </html>', htmlspecialchars($request->getParam('name', 'World')) )); } }

This code generates a HTML page that shows a headline "Hello World" or "Hello $something" when something was given as GET-parameter "name".

Override doPost() or any of the other methods named after HTTP request types to serve these request types, as well.

Running it

Use the xp web runner to serve your scriptlet:

$ xp web com.example.web.HelloScriptlet [xpws-dev#7312] running localhost:8080 @ /path/to/web/project - Press <Enter> to exit

Now open http://localhost:8080/ in your browser.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固