Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Sendgrid Can't Find Unirest


Go to End


1261 Views

Avatar
banksy

Community Member, 4 Posts

24 March 2016 at 11:37am

I have a form that sends to an email. I have used composer to install sendgrid and things used to work when I originally set it up.

It's now some time later and my dev site is getting closer to a production release, so I was retesting the forms and they fail.

I've no doubt changed something in the interim that has broken it, but I'm struggling a bit to figure out what.

The error is:

Fatal error: Class 'Unirest' not found in /home/ubuntu/workspace/vendor/sendgrid/sendgrid/lib/SendGrid/Web.php on line 20

My composer.json is:

{
	"name": "silverstripe/installer",
	"description": "The SilverStripe Framework Installer",
	"require": {
		"php": ">=5.3.3",
		"silverstripe/cms": "3.2.0",
		"silverstripe/framework": "3.2.0",
		"silverstripe/reports": "3.2.0",
		"silverstripe/siteconfig": "3.2.0",
		"silverstripe-themes/simple": "3.1.*",
		"frankmullenger/gallery": "1.1.x-dev",
		"sendgrid/sendgrid": "1.1.7",
		"mashape/unirest-php": "dev-master",
		"silverstripe/multiform": "*",
		"silverstripe/kickassets": "^3.1",
		"components/font-awesome": "^4.5"
	},
	"require-dev": {
		"phpunit/PHPUnit": "~3.7"
	},
	"config": {
		"process-timeout": 600
	},
	"prefer-stable": true,
	"minimum-stability": "dev"
}

So Sendgrid is clearly being autoloaded, but Unirest isn't for some reason.

If I put some debug code in it confirms that class_exists('SendGrid') returns true but class_exists('Unirest') returns false.

Any ideas on how to troubleshoot?

Thanks