没有Composer的Paypal核心SDK

Ben*_*Bos 5 php sdk paypal

我正在尝试让PHP Core SDK在没有作曲家的情况下工作.似乎没有一种简单的方法来使用没有作曲家的SDK(https://github.com/paypal/sdk-core-php)

有人有自动加载器脚本或其他解决方案才能使其工作吗?

我一直在扫描整个网络上的其他信息,但似乎我是唯一一个活着试图让它在没有Composer的情况下工作的人.

任何机会?谢谢!

Ben*_*Bos 4

好吧,看来我真的是这个星球上唯一愿意这样做的人了。好吧,那我自己来回答我的问题吧。看起来这是在没有 Composer 的情况下运行每个 Composer 包的指南。嘿嘿\o/。对于大多数使用 Composer 的人来说可能很简单,但我从未使用过它,因为我在一个糟糕的 Windows 共享主机上。

这是基于 debian 的,但将每个 apt-get 替换为 Redhat 或其他的 YUM。

所以,我在我的根目录中执行此操作,不要抱怨它:)

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.
Run Code Online (Sandbox Code Playgroud)

现在,您可以在包含所有内容的位置创建一个目录,称为 lib-package (或任何您想要的奇特名称),并在项目中添加以下行

require_once(/path/to/your/package/lib-package/vendor/autoload.php)

瞧,你完成了。