承接 jadempinky/pinkyflow 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  1. Download and install Laragon.
  2. Place your project files in the Laragon's www directory (usually C:\laragon\www\).
  3. Start Laragon and click the "Start All" button.
  4. Open your web browser and navigate to http://localhost/your-project-folder.

Using XAMPP or WAMP

  1. Download and install XAMPP or WAMP.
  2. Place your project files in the htdocs (XAMPP) or www (WAMP) directory.
  3. Start Apache and MySQL services from the control panel.
  4. 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 use statements.
  • 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 我们能提供哪些服务?
定制开发 / 二次开发

基于 jadempinky/pinkyflow 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-17