Download the PHP package afety/yaf-skeleton without Composer

On this page you can find all versions of the php package afety/yaf-skeleton. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yaf-skeleton

yaf项目模板

改造思想:

  1. 尽可能使用IDE的代码提示功能
  2. 将项目中的常用组件集成

顶级目录与文件

application目录结构

数据迁移组件 - doctrine\migration

database 迁移文件操作哦目录

使用方法:

ORM - Eloquent

Eloquent是一款较为优秀的orm组件,laravel框架便深度集成了Eloquent。因此关于Eloquent的教程文档较多 可以直接查看laravel文档 https://laravelacademy.org/post/8194.html 不过需要注意版本

使用Eloquent是为了将对数据库的访问隔离在Dao层,避免在Manager或Service层中直接对数据库的操作导致的重复代码与维护性的降低

与migration的集成:在迁移文件命令 php migration migrations:generateModel 能够自动生成Model文件会自动集成预先写好的Eloquent Model基类,MysqlModel或者MongodbModel,分别对应model类对MySQL、MongoDB的访问

Eloquent支持两种数据库使用模式,一种为Model类继承后的表模块类的使用方式,一种是直接的SQL运行方式

Model继承方式的使用可以参考Eloquent文档

直接的SQL运行方式:\DB::connection()->select($rawSql); 返回结果为stdClass对象数组

消息队列与持久化 - resque+supervisor

使用resque是为了替代cli运行模式,相比较使用popen来运行后台任务,使用resque做任务队列能够做到对后台任务的运行、重试、失败等做较全面的监控。

resque是基于redis做的消息队列,较为轻量级

supervisor负责监控需要常驻的任务进程,如日志消费、企业微信通知发送等。 在主目录的supervisor.ini文件就可以指定监控任务

HTTP访问 - guzzlehttp

替换掉对原生Curl的直接使用,避免对curl的学习门槛导致的代码问题。 GuzzleHttp提供了异步http等较为先进的特性。 同时GuzzleHttp支持所有实现了PSR-7标准的请求与响应,也提高了扩展性。

ExtInterface目录下的文件都需要继承AbstractApi,该类实现了对http访问的封装

crontab周期任务管理 - jobby

将crontab的任务监控纳入到代码跟踪,避免需要操作生产机器以及可能存在的忘记在crontab添加新增或删除过时任务

配置分级 env -> config

现有配置分为env环境变量配置与config系统配置

env目录为环境变量目录,依据不同环境进行配置分割,开发、测试环境加载develop.ini文件,生产环境加载product.ini文件

config目录下为系统配置文件

新的配置系统将生产配置文件纳入管理,方便生产配置的变更,同时使用文件划分的方式来进行环境分割,尽可能避免误操作

composer类加载 - psr-7

yaf类很多都需要带默认后缀Model,如models/Bll/Data/Amt.php 中定义的类为 AmtModel 个人不太喜欢,因此使用composer支持的psr-7类加载机制替换掉yaf默认的类加载方法

同时使用composer的files加载选项载入复制函数文件Helper.php

错误与异常处理

在Bootstrap文件中将捕捉到的Error转换为Exception抛出后由Error.php文件的errorAction函数统一处理 通过异常code或者所属异常类进行不同的处理

常量的加载是在应用的初始化时候做的 在配置与应用代码之间加入常量目录是为了使用IDE的自动补全功能,避免拼写错误等问题

缓存标准化

PSR-16标准:https://learnku.com/docs/psr/psr-16-simple-cache/1628


All versions of yaf-skeleton with dependencies

PHP Build Version
Package Version
Requires hellogerard/jobby Version ^3.5
doctrine/migrations Version ^2.3
illuminate/database Version ^5.8
illuminate/events Version ^5.8
illuminate/pagination Version ^5.8
ext-json Version *
symfony/mime Version ^4.4
intervention/image Version ^2.5
ext-simplexml Version *
resque/php-resque Version ^1.3
ext-pcntl Version *
ext-posix Version *
jenssegers/mongodb Version ^3.6
monolog/monolog Version ^1.26
predis/predis Version ^1.1
guzzlehttp/guzzle Version ^6.5
ext-redis Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package afety/yaf-skeleton contains the following files

Loading the files please wait ....