我正在尝试让 PHP Core SDK 在没有 Composer 的情况下工作。似乎没有一种简单的方法可以在没有 Composer 的情况下使用 SDK(https://github.com/paypal/sdk-core-php)
有人有机会使用自动加载器脚本或其他解决方案来实现此功能吗?
我一直在整个网络上搜索其他信息,但似乎我是唯一一个在没有 Composer 的情况下尝试让它工作的人。
有机会吗?谢谢!
最佳答案
好吧,看来我真的是这个星球上唯一想做这件事的人了。好吧,那么我会自己回答我的问题。似乎这是在没有 Composer 的情况下运行每个 Composer 包的指南。 Yihaa\o/.对于大多数使用 composer 的人来说,这可能是简单的事情,但我从未使用过它,因为我在一个糟糕的 Windows 共享主机上。
这是基于 debian,但将每个 apt-get 替换为 YUM for redhat 或其他。
所以,我在我的根目录中执行此操作,不要提示 :)
通过 SSH 进入您的 Linux Box(本地 mac 或 windows 也可以,但我不会告诉您)
# cd into the root directory (or user directory)
cd ~/
# install php5 and php5-curl and unzip (because the package we're
# getting is from GitHub). There might be other stuff your package is asking for.
# So just include it at the end
apt-get install php-5 php5-curl unzip
# install composer
curl -sS https://getcomposer.org/installer | php
# get the master archive
wget https://github.com/paypal/sdk-core-php/archive/master.zip
# unzip it
unzip master.zip
# cd into the directory
cd master
# move the files back to the ~/ directory
mv * ..
# remove the master directory
rm -r master
# install package using composer
php composer.phar install
# now we have the lib directory and the vendor directory. Lets tar that up
tar -cf package.tar lib/ vendor/
#we now have a tar file called package.tar copy that to your computer, ftp, whatever.
您现在可以在包含所有内容的地方创建一个名为 lib-package(或您喜欢的任何奇特名称)的目录,并在您的项目中添加以下行
require_once(/path/to/your/package/lib-package/vendor/autoload.php)
瞧,大功告成。
关于php - 没有 Composer 的 Paypal 核心 SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26518949/