salamek/nette-tempnam
Composer 安装命令:
composer require salamek/nette-tempnam
包简介
This is a simple tempnam extension for Nette Framework
README 文档
README
This is a simple tempnam extension for Nette Framework It creates temp files in %tempDir%/tempnam
Why ?
Sometines you just need to create tempfile such as PDF, Latte templates etc... and you dont want to put them into sys_get_temp_dir() (/tmp) and keep them in your Nette project %tempDir%... or just acces same temp file multiple times
Instalation
The best way to install salamek/nette-tempnam is using Composer:
$ composer require salamek/nette-tempnam:@dev
Then you have to register extension in config.neon.
extensions: tempnam: Salamek\Tempnam\DI\TempnamExtension
If you wish to change tempnam path just add this to your config:
tempnam: tempDir: %tempDir%/tempnam
Usage example
/** @var Salamek\Tempnam\Tempnam @inject */ public $tempnam; $key = 'my_tempnam_key_1'; // Lets say ID of record in database $data = 'My File COntent'; // Lets say record from database we want as file $updatedAt = new \DateTime('YYYY-mm-dd'); // Lets say updatedAt column from database to expire tempnam file when record in database is changed // Load temFile Path or null $tempFile = $this->tempnam->load($key, $updatedAt); if ($tempFile === null) { $tempFile = $this->tempnam->save($key, $data, $updatedAt); } echo file_get_contents($tempFile); // My File COntent
Methods
$this->tempnam->getTempDir(); //Returns tempDir $this->tempnam->remove($key); //Removes tempnam file by its $key $this->tempnam->load($key, \DateTimeInterface $updatedAt = null); //Returns tempnam file path by its key if updatedAt matches or returns null $this->tempnam->save($key, $data, \DateTimeInterface $updatedAt = null) //Saves tempnam file by $key with $data content, returns tempnam path
salamek/nette-tempnam 适用场景与选型建议
salamek/nette-tempnam 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 173 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 07 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nette」 「tempnam」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 salamek/nette-tempnam 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 salamek/nette-tempnam 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 salamek/nette-tempnam 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Alternative to tmpfile() function.
Nette Framework adapter for I18n package
Build forms from schema
Asynchronous MQTT client built on React
Form with datetime support and Bootstrap 4 form renderer
Identity authorizator class for Nette Framework
统计信息
- 总下载量: 173
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2017-07-25