简体   繁体   English

在没有Composer的Wordpress中使用SendGrid PHP API

[英]Using SendGrid PHP API in Wordpress without Composer

The title mainly says it all but I'm at a loss as to how I should use the SendGrid php library without Composer in Wordpress. 标题主要说明了所有内容,但我对如何在Wordpress中使用没有Composer的SendGrid php库感到困惑。 It's not as simple as the SendGrid github readme.md makes it out to be: 它不像SendGrid github readme.md那样简单:

// If you are not using Composer
// require("path/to/sendgrid-php/sendgrid-php.php");

This is because sendgrid-php.php contains the following: 这是因为sendgrid-php.php包含以下内容:

<?php
require __DIR__ . '/vendor/autoload.php';
?>

So even if you aren't calling autoload.php yourself, the sendgrid file is. 因此,即使您自己没有调用autoload.php,sendgrid文件也是如此。

Is there a way to use the library without composer? 有没有办法在没有作曲家的情况下使用库? Because composer does not work with Wordpress (except through some janky workarounds). 因为composer不能与Wordpress一起使用(除非通过一些麻烦的解决方法)。

If anyone has experience with this I'd love to hear your thoughts. 如果有人对此有经验,我很想听听您的想法。

Thanks. 谢谢。

If u don't want to use composer. 如果您不想使用作曲家。 Try to download the package here . 尝试在此处下载软件包。 Then extract the lib folder to your (child) theme. 然后将lib文件夹提取到您的(子)主题。 Then in your functions.php add this code: 然后在您的functions.php添加以下代码:

require_once(__DIR__ . '/lib/loader.php');
// Use Send grid right here...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM