如何将新的非git 私有package/classes 添加到PHP 应用程序?

How to add a new non-git private package/classes to a PHP application?

我有一个包含 6-7 个文件的小包(即主要 class、扩展 classes、界面,可以在 this link 中查看)并且我会喜欢不使用 require_once 方法将这些 class 连接在一起。

这样做的正确方法是什么?

尝试次数

我尝试使用 将它们添加到 vendor 目录。

composer require our-new-package-private

composer require our-new-package-private ~1.0.0

它returns一个错误:

  [InvalidArgumentException]                                                                                                                         
  Could not find a matching version of package equity-usco. Check the package spelling, your version constraint and that the package is available i  
  n a stability which matches your minimum-stability (stable). 

问题

目前仍然无法从存储库子文件夹/ (Github Issue)

创建 composer 包

您可以按照此 Packagist link 创建您自己的程序包。

Define Your Package

Put a file named composer.json at the root of your package's repository, containing this information:

{
    "name": "your-vendor-name/package-name",
    "description": "A short description of what your package does",
    "require": {
        "php": "^7.2",
        "another-vendor/package": "1.*"
    }
}

This is the strictly minimal information you have to give.

For more details about package naming and the fields you can use to document your package better, see the about page.

Commit The File

Add the composer.json to your git or other VCS repository and commit it.

Publish It

Login or register on (the) site, then hit the submit button in the menu.

[...]