PHPackages                             nigestream/xwork - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. nigestream/xwork

ActiveLibrary[Framework](/categories/framework)

nigestream/xwork
================

一个敏捷开发的深度orm的php开发框架

v1.0.0-beta1(7y ago)9176MITPHPPHP &gt;=7.1.0

Since Jan 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/nigestream/xwork)[ Packagist](https://packagist.org/packages/nigestream/xwork)[ RSS](/packages/nigestream-xwork/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

XWork
=====

[](#xwork)

介绍
--

[](#介绍)

**xwork** 是一款轻量级的面向对象php开发框架，它基于`ORM、UnitOfWork(工作单元)、MVC`等。没有复杂的设计模式，没有复杂的外部接口，一切只为了简单，代码简单、逻辑清晰。尽可能的使用约定，消除不必要的配置文件。
这里没有中间件，没有控制反转，没有`Facade`，超轻量级路由，为了就是学习成本低、上手快，让你能够更快的投入到项目开发中去。
数据操作完全面向对象，自研的ORM模块配合工作单元，让您飞一般的玩转数据。当然这里牺牲了一点性能，但是对于web项目来说，那点性能可以忽略不计（个人认为，不喜勿喷）

架构
--

[](#架构)

[![xwork](https://camo.githubusercontent.com/db4a865247e155156b935cba3a5991c249f3b6d39f47de7868e8af76ec0127c0/687474703a2f2f73742e64617869616e6762616e6b612e636f6d2f70686f746f2f332f32352f33323538363233366466633863643137386538376631333462386636343331652e706e67)](https://camo.githubusercontent.com/db4a865247e155156b935cba3a5991c249f3b6d39f47de7868e8af76ec0127c0/687474703a2f2f73742e64617869616e6762616e6b612e636f6d2f70686f746f2f332f32352f33323538363233366466633863643137386538376631333462386636343331652e706e67)
架构还是标准的mvc+dao框架架构，特殊的是xwork深度结合ORM，这里没有选择，必须使用ORM。。。
orm和工作单元的深度结合，使得关于表设计和逻辑组织都非常的简单、迅速和高效。

项目结构
----

[](#项目结构)

```
├── audit
│   ├── ActionMap.properties.php 路由配置
│   ├── AuditBaseAction.php 子系统基类
│   ├── action 其实就是controller
│   │   └── DemoAction.php 里面的doMethod其实就是action
│   └── tpl 模板，直接php渲染吧，不想再学一门模板语法了
├── domain 重要！！ 领域逻辑，关于这点请阅读领域驱动设计
│   ├── BaseAction.php 所有子系统的基类action
│   ├── UrlFor.php url生成器
│   ├── dao 数据访问对象Dao，它返回的是实体
│   │   ├── HotelDao.php
│   │   ├── RoomDao.php
│   │   └── UserDao.php
│   ├── entity 实体，表的映射
│   │   ├── Hotel.php
│   │   ├── Room.php
│   │   └── User.php
│   ├── lib 一些公共库
│   │   └── Util.php
│   └── service 服务层，封装一些复杂业务逻辑
│       ├── HotelService.php
│       ├── RoomService.php
│       └── UserService.php
├── script 脚本，包括但不限于定时脚本、消息队列消费者等等
├── sys
│   ├── PathDefine.php app路径的定义
│   └── config 配置文件，需要用symlink ln -svf config.prod.php config.php
│       ├── config.php
│       ├── config.sample.php
│       └── config.unit.php
├── www www子系统，一般用于官网主站
│   ├── ActionMap.properties.php
│   ├── WwwBaseAction.php
│   ├── action
│   │   ├── DemoAction.php
│   │   ├── HotelAction.php
│   │   ├── IndexAction.php
│   │   ├── RoomAction.php
│   │   └── UserAction.php
│   └── tpl
└── wwwroot
    ├── audit 子系统入口
    │   └── index.php
    └── www 子系统入口
        └── index.php

```

你可以通过`xworker`脚手架来新建项目

安装
--

[](#安装)

1. 给你的项目起个名字，比如：`mkdir pinduoduo`
2. `cd pinduoduo`
3. `composer require "nigestream/xwork"`
4. 接下来设置个环境变量 `export PATH=$PATH:vendor/bin`
5. 现在你可以执行`xworker`看一下效果了[![xworker](https://camo.githubusercontent.com/d795784452d568ebe90200b7ee50edad5dce2abc2934b4348ea2c86465d1226a/687474703a2f2f73742e64617869616e6762616e6b612e636f6d2f70686f746f2f662f64372f66643732386662616563333865653964613831646336393164646430373561312e706e67)](https://camo.githubusercontent.com/d795784452d568ebe90200b7ee50edad5dce2abc2934b4348ea2c86465d1226a/687474703a2f2f73742e64617869616e6762616e6b612e636f6d2f70686f746f2f662f64372f66643732386662616563333865653964613831646336393164646430373561312e706e67)
6. 我们来初始化一个项目，执行命令`xworker make:init`， 会在当前目录下新建一个app目录，即上述**项目结构**所示
7. 以后你就可以用项目目录下的`xworker`来执行了, 比如:`php xworker make:new`（忘记第4步的环境变量吧）

**注意**：项目的entity目录使用classmap映射加载的，非PSR-4自动加载方式。
所有新增的实体类必须放在app/domain/entity目录下，且需要执行`composer dumpautoload`来生成classmap；但如果使用xworker make:entity 则会自动执行` composer dumpautoload`。

模块设计
----

[](#模块设计)

### Entity

[](#entity)

`todo` @淘小金

### Dao

[](#dao)

`todo` @叶孤城

### UnitOfWork

[](#unitofwork)

`todo` @老史

### MVC

[](#mvc)

`todo` @大哥大

todos
-----

[](#todos)

- XController 需要重构
- 是否考虑引入一个高大上的路由？
- 尽可能的暴露一些用户可自定义的接口
- 完善文档
- 清理代码，删除一些没必要的文件

Contributors
------------

[](#contributors)

- 老史
- 淘小金
- 叶孤城
- 大哥大

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2674d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/66f84cb58b29df8fc917d7adea44e85ae92cbd869f3324a5731e237bc4a1ff9b?d=identicon)[nigestream](/maintainers/nigestream)

---

Top Contributors

[![nigestream](https://avatars.githubusercontent.com/u/4231032?v=4)](https://github.com/nigestream "nigestream (13 commits)")

---

Tags

php frameworkagilityxwork

### Embed Badge

![Health badge](/badges/nigestream-xwork/health.svg)

```
[![Health](https://phpackages.com/badges/nigestream-xwork/health.svg)](https://phpackages.com/packages/nigestream-xwork)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M258](/packages/laravel-dusk)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
