PHPackages                             pylxu/cses-php - 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. pylxu/cses-php

ActiveLibrary[Framework](/categories/framework)

pylxu/cses-php
==============

CSES access framework for PHP

1.0.0(1y ago)12MITPHPPHP ^7.4 || ^8.0

Since Feb 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/CSES-org/cses-php)[ Packagist](https://packagist.org/packages/pylxu/cses-php)[ RSS](/packages/pylxu-cses-php/feed)WikiDiscussions main Synced 1mo ago

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

CSES PHP Library
================

[](#cses-php-library)

[![PHP Version](https://camo.githubusercontent.com/b43c9d6cd8939c4868f963284928566c4c35dd2da0725c027f95a3d62f2f0329/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342532422d626c75652e737667)](https://php.net)[![License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![Packagist Version](https://camo.githubusercontent.com/72e6544968fabe55feadac984939b6139f1d2c03ff304b567e986b6c0138fd05/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70796c78752f637365732d706870)](https://packagist.org/packages/pylxu/cses-php)

用于解析和生成 CSES（Curriculum Schedule Exchange Standard）课程表格式的PHP库

\**本仓库部分代码以及文件说明由DeepSeek提供支持*

📦 安装
----

[](#-安装)

通过 Composer 安装：

```
composer require pylxu/cses-php
```

🚀 快速开始
------

[](#-快速开始)

### 解析CSES文件

[](#解析cses文件)

```
use CSES\CSESParser;

try {
    $parser = new CSESParser('schedule.cses.yml');

    // 获取所有科目
    $subjects = $parser->getSubjects();

    // 获取星期一的课程
    $mondayClasses = $parser->getScheduleByDay('mon');

} catch (RuntimeException $e) {
    echo "错误: " . $e->getMessage();
}
```

### 生成CSES文件

[](#生成cses文件)

```
use CSES\CSESGenerator;

$generator = new CSESGenerator();

// 添加科目
$generator->addSubject(
    '高等数学',
    '高数',
    '王教授',
    '逸夫楼203'
);

// 添加课程安排
$generator->addSchedule('周一', 'mon', 'all', [
    [
        'subject' => '高等数学',
        'start_time' => '08:00',
        'end_time' => '09:35'
    ]
]);

// 保存文件
$generator->saveToFile('new_schedule.cses.yml');
```

📚 详细文档
------

[](#-详细文档)

### CSESParser 类

[](#csesparser-类)

方法说明`__construct(string $filePath)`初始化解析器并加载文件`getSubjects(): array`返回所有科目信息`getSchedules(): array`返回完整课程表结构`getScheduleByDay(string $day): array`按星期几获取课程（支持：mon/tue/wed/thu/fri/sat/sun）`isCsesFile(string $filePath): bool`静态方法验证文件格式### CSESGenerator 类

[](#csesgenerator-类)

方法说明`addSubject(string $name, ?string $simplifiedName, ?string $teacher, ?string $room)`添加科目信息`addSchedule(string $name, string $enableDay, string $weeks, array $classes)`添加课程安排`generateCsesData(): array`生成原始数组数据`saveToFile(string $filePath)`保存为YAML文件📝 数据格式说明
--------

[](#-数据格式说明)

### 科目结构

[](#科目结构)

```
subjects:
  - name: "科目全称"
    simplified_name: "简称"    # 可选
    teacher: "教师姓名"        # 可选
    room: "教室编号"          # 可选
```

### 课程表结构

[](#课程表结构)

```
schedules:
  - name: "周一"
    enable_day: "mon"        # 启用星期（小写缩写）
    weeks: "all"             # 周次类型：all/odd/even
    classes:
      - subject: "科目名称"
        start_time: "08:00"
        end_time: "09:35"
```

⚠️ 注意事项
-------

[](#️-注意事项)

1. 时间格式必须使用24小时制
2. `enable_day` 只接受标准英文缩写：mon/tue/wed/thu/fri/sat/sun
3. 周次类型 `weeks` 可选值：
    - `all`: 每周
    - `odd`: 单周
    - `even`: 双周

🤝 参与贡献
------

[](#-参与贡献)

欢迎通过 Issue 报告问题或提交 Pull Request：

1. Fork 项目仓库
2. 创建特性分支 (`git checkout -b feature/your-feature`)
3. 提交更改 (`git commit -am 'Add some feature'`)
4. 推送分支 (`git push origin feature/your-feature`)
5. 创建 Pull Request

📄 许可证
-----

[](#-许可证)

本项目基于 [MIT License](LICENSE) 发布

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

469d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/21ac09276e2e731b13867e44fd0850b5be943b9d81217db1625da99daa642870?d=identicon)[PYLXU](/maintainers/PYLXU)

---

Top Contributors

[![PYLXU](https://avatars.githubusercontent.com/u/104706823?v=4)](https://github.com/PYLXU "PYLXU (12 commits)")

### Embed Badge

![Health badge](/badges/pylxu-cses-php/health.svg)

```
[![Health](https://phpackages.com/badges/pylxu-cses-php/health.svg)](https://phpackages.com/packages/pylxu-cses-php)
```

###  Alternatives

[laravel/sail

Docker files for running a basic Laravel application.

1.9k186.9M1.0k](/packages/laravel-sail)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

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

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

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[getkirby/cms

The Kirby core

1.5k535.5k352](/packages/getkirby-cms)

PHPackages © 2026

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