jadempinky/pinkyflow
Composer 安装命令:
composer require jadempinky/pinkyflow
包简介
A PHP framework that makes your code flow like water. PinkyFlow provides essential modules like user management, shopping cart, and commenting, while maintaining flexibility for custom extensions.
README 文档
README
PinkyFlow is a simple and modular PHP framework designed for tasks like user management, shopping carts, comments, and more. It handles autoloading, database interactions, and module initialization, allowing you to focus on building your application.
Getting Started
1. Install via Composer
To install PinkyFlow in your project, use Composer:
composer require jadempinky/pinkyflow
2. Configuring the Framework
PinkyFlow uses a config/config.php file for configuration. Edit the values to your needs.
<?php namespace PinkyFlow; class Config { public static $enableDatabase = true; public static $enableUserModule = true; public static $enableShoppingModule = true; public static $enableCommentModule = true; public static $dbHost = 'localhost'; // Database host public static $dbUser = 'root'; // Database username public static $dbPass = ''; // Database password public static $dbName = 'pinkyflow'; // Database name }
3. Example: User Registration and Login
The following code demonstrates how to use PinkyFlow for user registration, login, and retrieving user details:
Index :
<?php require_once __DIR__ . '/vendor/jadempinky/pinkyflow/PinkyFlow.php'; ?>
ProfileController :
<?php class ProfileController { private $user; private $basepathforcss; public function __construct($user, $basepathforcss) { $this->user = $user; $this->basepathforcss = $basepathforcss; } public function handleProfile() { if (!$this->user->isLoggedIn()) { header("Location: {$this->basepathforcss}/login"); exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['profile_picture'])) { $this->user->handleProfilePicture($_FILES['profile_picture']); } // Handle logout if ($user->isLoggedIn()) { echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post"><button type="submit" name="logout">Logout</button></form>'; } if (isset($_POST['logout'])) { $user->logout(); } } } $profile = new ProfileController($user, $basepathforcss); $profile->handleProfile(); ?>
Profile view :
<?php <div class="profile-container"> <div class="profile-header"> <img src="<?php echo $user->getProfilePicture(); ?>" alt="<?php echo $user->getUsername(); ?>'s Profile Picture" onclick="showfileinput()"> <h1>Profile</h1> <form method="post" enctype="multipart/form-data"> <input type="file" id="fileinput" name="profile_picture" accept="image/*" style="display: none;" onchange="this.form.submit()"> </form> </div> <ul class="profile-details"> <li><span>Username:</span> <?php echo $user->getUsername(); ?></li> <li><span>Email:</span> <?php echo $user->getEmail(); ?></li> <li><span>Role:</span> <?php echo $user->getRole(); ?></li> </ul> <p><a href="<?php echo $basepathforcss ?>/logout">Logout</a></p> </div> <script> function showfileinput() { document.getElementById('fileinput').click(); } </script> ?>
Login-Register system
// Handle register / login if (!$user->isLoggedIn()) { if (isset($_POST['register'])) { $user->register($_POST['username'], $_POST['password'], $_POST['password'], $_POST['email']); } if (isset($_POST['login'])) { $user->login($_POST['username'], $_POST['password']); } } <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="username" placeholder="Username"><br> <input type="password" name="password" placeholder="Password"><br> <input type="email" name="email" placeholder="Email"><br> <button type="submit" name="register">Register</button> </form> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="username" placeholder="Username"><br> <input type="password" name="password" placeholder="Password"><br> <button type="submit" name="login">Login</button> </form>
Running Your Code
To see your code in action, you can use local development environments like Laragon, XAMPP, or WAMP. These applications provide an easy way to set up a local web server and database on your machine.
Using Laragon
- Download and install Laragon.
- Place your project files in the Laragon's
wwwdirectory (usuallyC:\laragon\www\). - Start Laragon and click the "Start All" button.
- Open your web browser and navigate to
http://localhost/your-project-folder.
Using XAMPP or WAMP
- Download and install XAMPP or WAMP.
- Place your project files in the
htdocs(XAMPP) orwww(WAMP) directory. - Start Apache and MySQL services from the control panel.
- Open your web browser and navigate to
http://localhost/your-project-folder.
Remember to configure your database settings in the Config class to match your local environment.
By using these tools, you can easily test and debug your PinkyFlow application on your local machine before deploying it to a live server.
Key Features
- Automatic Database Handling: PinkyFlow creates the database and necessary tables automatically.
- Autoloading: Classes and modules are loaded automatically. No need for manual
usestatements. - User Management: Easily handle user registration, login, and details retrieval with minimal code.
- Shopping Cart: Implement shopping cart functionality with ease.
- Comment System: Add and manage comments in your application.
- New Modules coming soon:
License
PinkyFlow is open-source and licensed under the MIT License.
jadempinky/pinkyflow 适用场景与选型建议
jadempinky/pinkyflow 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 2, 最近一次更新时间为 2024 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jadempinky/pinkyflow 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jadempinky/pinkyflow 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-17