定制 a7/autoload 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

a7/autoload

Composer 安装命令:

composer require a7/autoload

包简介

Automatically and recursively require_once all php files in a given directory.

README 文档

README

Purpose

Automatically load PHP files in the specified directory. Recursively.

Benefits

  • Rename files with no fear of breaking includes or require calls
  • Encourages using more files to more cleanly organize code into smaller logical chunks
  • Reduce git merge conflicts with other developers

Installation

composer require a7/autoload

Usage

Be sure to include the regular composer load file via require( __DIR__ . '/vendor/autoload.php' );.

Please note that although similarly named, this Autoload library is meant for loading all PHP files in a given directory. This does NOT function in the manner of the built-in PSR-4 PHP Autoloader. This is meant for PHP files which are just simple functions (i.e. not class based files)

Simply load your desired src or whatever directory by calling:

\A7\autoload( __DIR__ . '\src' );

Inclusion Notes

Will throw exceptions if:

  • there are more than 250 files in a directory
  • any of the php files are larger than 300kb
  • any of the php files are negative filesize (indicates something really funky going on)

Caveats

Since this is a recursive loader, you should be conscious of what you're placing in your autoloaded directory.

Not recommended:

  • Placing a big (or any) PHP library in the autoloaded directory (this should/could be handled better with composer anyways!)
  • Being lax with permissions on a server. Obviously this is never a good idea, but I would be sure that your folder / file permissions are up to snuff (or strange files may be loaded)
  • Trying to autoload node_modules or any other large volume of folders and files

Disclaimer

Be aware that this may not be the right choice for your project. Please be fully aware of what this plugin does and how it works.

统计信息

  • 总下载量: 20.41k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2017-03-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固