我正在尝试将WHAnonymous API集成到我的symfony项目中。
我已经使用composer install将它包含在我的项目中,现在它在我的供应商文件夹中。
但我不明白如何导入它到我的项目!
这是我的经理班。
<?php
namespace AppBundle'Managers;
use Sensio'Bundle'FrameworkExtraBundle'Configuration'Route;
class WhatsAppManager
{
private $test;
/**
* Constructor
*/
public function __construct()
{
$this->test =1;
}
public function sendMessage()
{
$username = ""; // Your number with country code, ie: 34123456789
$nickname = ""; // Your nickname, it will appear in push notifications
$debug = true; // Shows debug log
// Create a instance of WhastPort.
$w = new WhatsProt($username, $nickname, $debug);
var_dump("In send message method");
}
}
?>
我用过
require_once 'whatsprot.class.php';
和
require_once 'Whatsapp'Bundle'Chat-api'src'whatsprot.class.php';
和
use Whatsapp'Bundle'Chat-api'Whatsprot
但它就是不工作。请告诉我正确的做法!当我在symfony中使用第三方供应商时,我应该做些什么吗?
我确实查看了WHanonymous的文档,但我发现只有一小段代码可以使用它,而不是导入它的方式。Git repo for WHAnonymous: https://github.com/WHAnonymous
这个类没有名称空间,但是被创建的自动加载系统正确加载。因此,您可以在没有任何include或require指令的情况下引用类,而只需使用'
作为示例:
// Create a instance of WhastPort.
$w = new 'WhatsProt($username, $nickname, $debug);
希望对您有所帮助