languaojs/viperphp
Composer 安装命令:
composer create-project languaojs/viperphp
包简介
A PHP Framework
README 文档
README
ViperPHP is a lightweight, easy-to-use, and secure PHP framework designed for rapid development. It features a clean structure, a built-in CLI tool, and a flexible asset management system.
🚀 Installation
Install ViperPHP using Composer:
composer create-project languaojs/viperphp your-app-name
This should be followed by:
composer update
And
composer dump-autoload
Then, go to config/Config.php and set your base URL (e.g., http://localhost/your-app-name). Run XAMPP or WAMP, the go to your app URL.
🛠 Getting Started
1. The Home Page
To edit the main landing page, go to:
app/Views/home/index.php
2. The Navigation Menu
To edit the global navbar, go to:
app/Views/partials/home-menu.php
3. Configuration
To set your App Name, Security Keys, or Database Credentials, open:
config/Config.php
📄 Creating a New Page
To create a new page (e.g., About), follow these steps:
1. Create a Controller:
Open your terminal and type:
php craft make:controller About
Alternatively, manually create app/Controllers/About.php.
2. Set up the logic
Inside your new controller, ensure you have an index() method. You can copy the structure from Home.php.
3. Create the view
- Create a folder:
app/Views/about/ - Create a file:
app/Views/about/index.php
4. Connect Controller to a view
In your About.php controller, update the view call:
$this->view('about/index');
🎨 Asset Management (CSS & JS)
ViperPHP uses a unique method to register and load assets, allowing you to load only what you need per page.
Registering Assets
Go to app/Libraries/Assets.php to register your files. You can use local files or CDN links:
- Place local files in public/assets/css/ or public/assets/js/.
- Register them in the
Assets.phplibrary. - Set Default Assets in this file to load them on every page automatically.
Loading Assets in the Controller
You can determine which assets load for a specific method directly in the controller.
🖼 Media & Images
All images and media files should be placed in public/media/.
Retrieving Media
Use the get_media($path) helper function to generate the correct URL. This function supports subfolders and filenames.
Example Usage:
<!-- To get an image named code2.png --> <img src="<?= get_media('code2.png'); ?>" alt="My Image">
How to set assets in the controller
Classes and Files naming conventions
As usual, the class name and the file name must be identical. So, if the class is Home_model, the file name must be Home_model.php. This also applies to the Controllers. For instance, the Controller class User must have the file name User.php. For Controllers and Models, avoid using PascalCase, though it is typical. If you want to use PascalCase, you can modify the Router and Controller classes, which are located in the system directory.
Classes in the Libraries directory, both in the system and app directories, can use PascalCase.
The methods and functions can be written using PascalCase() or underscored_pattern().
languaojs/viperphp 适用场景与选型建议
languaojs/viperphp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 languaojs/viperphp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 languaojs/viperphp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-13