lopatar/php-sdkv2 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

lopatar/php-sdkv2

最新稳定版本:v3.2.2

Composer 安装命令:

composer require lopatar/php-sdkv2

包简介

Second generation of my experimental PHP SDK!

README 文档

README

Powerful PHP framework, written in PHP 8.4, modernised version of rather primitive PHP SDK (which is now archived).

Currently trying to stay in line with current PHP updates.

Requirements

  • PHP 8.4
  • Composer
  • Web server (routing all requests to public/index.php)

Installation

To install the SDK, there are two ways.

Skeleton project

To use the skeleton project run the following composer command.

composer create-project lopatar/php-sdkv2-skeleton <PROJECT-NAME>

Manual installation

composer require "lopatar/php-sdkv2"
  • Create following directory structure in the folder where the "vendor" folder resides

    • App
      • Controllers (where your controller files reside)
      • Views (where your view files reside)
      • Models (where your model files reside)
  • Map the App namespace in composer.json like so

{
  "autoload": {
    "psr-4": {
      "App\\": "App/"
    }
  }
}
  • Create your configuration class

  • Done!

Routing requests to index.php

  • NGINX
    root /path/to/public;
    index index.php;

    location / {
        try_files $uri /index.php$is_args$args =404;
    }

Recommended plugins

Configuration class

The App object expects an instance of IConfig passed to the constructor, please create your class such as:

<?php
final class Config implements \Sdk\IConfig
{

}

Features

  • Request object
    • URL management
    • Cookie management
      • Cookies can be automatically encrypted & decrypted using AES-256-CBC
    • Headers, GET, POST, SERVER variables management
  • Response object
    • View system (injecting PHP variables into HTML code)
    • Status code, body (writing, flushing) management
  • Routing
    • Anonymous callbacks / ControllerName::methodName
    • URL parameters (type validation, min & max value (length for strings), escaping)
  • Middleware (can be used on specific Routes or the App object)
    • IMiddleware interface (used to define your own middleware)
    • Session middleware, used storing data across requests
    • CSRF middleware, used to protect against CSRF attacks
      • Use CSRF::getInputField for HTML POST forms, or CSRF::getToken for sending requests with the header Csrf-Token
    • HttpBasicAuth middleware, used for basic HTTP auth, compares passwords hashed using password_hash
    • Redirect middleware, useful for redirecting right in the request processing chain.
  • Database connectors
  • Utilities namespace
  • Structures namespace
    • Stack Fixed size stack implementation allowing mixed data type values
    • Queue Fixed size queue implementation allowing mixed data type values
  • Config object

统计信息

  • 总下载量: 151
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: WTFPL
  • 更新时间: 2022-11-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固