bright-webb/cobra
Composer 安装命令:
composer require bright-webb/cobra
包简介
PHP library for managing and manipulating data
README 文档
README
Cobra is a data management for PHP to clean, modify and transform your data. Whether you're working with data from a database, CSV files, or arrays, Cobra provides a suite of tools to help you handle, transform, and analyze your data efficiently.
Features
- Load data from SQL databases and CSV files
- Transform and manipulate data using various methods
- Generate, display, and export data
- Handle missing data and perform statistical operations
- Merge, join, and concatenate data frames
Using cobra
Cobra has 3 class, DataFrame, DB and Series You can use the DB class to perform basic SQL operations such as select and query
Installation
composer require bright-webb/cobra
Usage
If you want to use cobra with your database, you must create a .env file, to create and use .env, you need to install vlucas/phpdotenv package
configure your environment as follows
- DB_USERNAME
- DB_PASSWORD
- DB_HOST
- DB_DATABASE
and that's it, cobra will be able to connect to your database, if you're using Laravel, even better.
use Cobra\DataFrame;
Create a new DataFrame Object
$df = new DataFrame();
You can load your data in 3 ways, from your database, csv or json. To load from your database, you use the table method
$df->table('table_name');
// from csv
$df->fromCsv('path');
Data Analysis
print_r($df->describe())
print($df->mean())
print($df->median())
print($df->average())
print($df->sum('column_name'))
print_r($df->groupBy('column_name'))
Data Manipulation
$df->head(); // You can also pass the number of rows as argument
print_r($df->toArray());
Can also be printed as html table
print($df->toTable());
Drop all null or blank columns
$df->dropna();
$df->fillna(); // You can also pass the the value to fill as argument
$df->dropColumn('column_name')
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
bright-webb/cobra 适用场景与选型建议
bright-webb/cobra 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 113 次下载、GitHub Stars 达 5, 最近一次更新时间为 2024 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 bright-webb/cobra 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bright-webb/cobra 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 113
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-06-14