一瓶新鲜的https://box.scotch.io/ (我通常推荐的)
和这位作曲家:
{
"name": "silverstripe/installer",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.3.3",
"silverstripe/cms": "3.5.1",
"silverstripe/framework": "3.5.1",
"silverstripe/reports": "3.5.1",
"silverstripe/siteconfig": "3.5.1",
"silverstripe-themes/simple": "3.1.*",
"silverstripe/silverstripe-omnipay": "^2.1",
"omnipay/paymentexpress": "^2.2",
"firebase/php-jwt": "^4.0"
},
"require-dev": {
"phpunit/PHPUnit": "~3.7@stable"
},
"extra": {
"branch-alias": {
"3.x-dev": "3.5.x-dev"
}
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}并使用https://github.com/silverstripe/silverstripe-omnipay中的payment.yml
Silverstripe构建支付,但不包括Omnipay类。我以前在SS上使用过Omnipay,没有任何问题。
有人知道这是怎么回事吗?
发布于 2017-02-08 01:19:58
silverstripe-omnipay的许多文件都使用php namespaces,而ServiceFactory恰好就是其中之一,因此为了让SilverStripe找到要包含的正确文件,您必须在要使用ServiceFactory的文件的顶部指定它的用途。
<?php use SilverStripe\Omnipay\Service\ServiceFactory; ...
这并不是很明显,因为为SilverStripe创建的模块很少使用名称空间fo和silverstripe-omnipay在其示例中没有提到ServiceFactory是名称空间的。
发布于 2017-02-01 16:55:54
确保在命令行上运行以下命令:
$> ./framework/sake dev/build flush=all
如果你使用的是F/S而不是memcache或其他类似的东西,那么也应该删除SS缓存的内容(你使用的是Vagrant,所以假设这是一个开发环境),它通常位于/tmp中,然后再次运行dev/build。这将清除和重建您的缓存,并在此过程中告诉SS它可以使用的所有新类。
发布于 2017-02-01 05:29:02
你得到了什么错误?你是如何尝试访问这些类的呢?
您应该能够像这样调用这些类(取决于Omnipay版本)
<?php
use Omnipay\Omnipay;
class PaymentPage extends Page
{
function ...
{
try {
$response = $gateway->purchase([...
}
}https://stackoverflow.com/questions/41967531
复制相似问题