哪里设置需要一次包括在laravel?

问题描述 投票:0回答:1

我的要求是将braintree包含在我的laravel应用程序中。第一步我将整个sdk复制到我的laravel app文件夹中,该文件夹名为braintree-php。接下来我进入我的C:\xampp\htdocs\cserver\resources\views\layouts,下面的app.blade.php是我的代码的一部分。

<!DOCTYPE html>
@section('includebt')

@show
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>My system @yield ('role-heading')</title>

然后我有我的实际刀片页面,我从上面的应用程序布局扩展。这只是代码的一部分,下面有更多详细信息,但我的重点是库包括。

@extends('layouts.app')


@section('includebt')
include(app_path().'/braintree-php/lib/Braintree.php');
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('**');
Braintree_Configuration::publicKey('***');
Braintree_Configuration::privateKey('***');

@endsection

我收到此错误Class 'Braintree\ClientToken' not found (View:

php laravel laravel-5 payment-gateway braintree
1个回答
1
投票

你应该通过作曲家这样做

打开composer.json文件只有一个请求使它

"require": { 
"laravel/framework": "5.0.*", 
"illuminate/html": "^5.0", 
"braintree/braintree_php" : "3.20.0" 
},

并使用工匠的作曲家更新

composer update

之后,您需要设置您的环境并生成客户端令牌并关注documentation。你也可以考虑去packagist

© www.soinside.com 2019 - 2024. All rights reserved.