File not found with Google Calendar API - php

I am having trouble doing the quickstart.php using the Composer dependency manager.
I have used Composer in order to require the Google Calendar API. autoload.php is present in the vendor folder. And I am just running the code from this page: https://developers.google.com/google-apps/calendar/quickstart/php
The error I am getting is
Fatal error: Uncaught Error: Class 'Google_Service_Calendar'
on quickstart.php line 12.
Does anyone know how I can fix this?
I've tried using: composer dump-autoload which has done nothing to remedy this.
Thanks!

Related

How do I correctly require a dependency plugin in Moodle 3.5

I have an activity plugin that requires another plugin to work correctly.
I followed the recommendation of requesting this plugin as a dependency in the version.php file like this :
$plugin->dependencies = array('local_aws' => 2017071501 ); //AWS php SDK dependency
The problem is when I install my plugin I receive a Warning :
Warning:
require_once(/var/www/moodle/local/aws/sdk/aws-autoloader.php): failed
to open stream: No such file or directory in
/var/www/moodle/mod/tutorship/lib.php on line 37
Fatal error: require_once(): Failed opening required
'/var/www/moodle/local/aws/sdk/aws-autoloader.php'
(include_path='/var/www/moodle/lib/pear:.:/usr/share/php') in
/var/www/moodle/mod/mymodulep/lib.php on line 37
Line 37 uses this code:
// For AWS API Part
require_once($CFG->dirroot . '/local/aws/sdk/aws-autoloader.php');
So it seems to me during the install of my plugin the require_ once is not being satisfied as the AWS plugin has yet to be installed. Well I followed the recommendation of making it a dependency in version.php but it isn't being installed before the require_ once is checked ?
How can I resolve this conundrum ?
I think you are right in your supposition that "require_ once is not being satisfied as the AWS plugin has yet to be installed". To avoid this kind of problem, you should try to avoid to require files of other plugins/libraries in lines that are actually executed during the plugin installation/upgrading procedures. Is it necessary to use the other plugin during the installation of yours?
I would move the require_once($CFG->dirroot . '/local/aws/sdk/aws-autoloader.php'); to some file that is never run during the actual installation/upgrading (avoid the header of lib.php). For example, I would create a class mod/tutorship/classes/some_class.php (properly "namespaced" with namespace mod_tutorship;), do the require_once there and then just instantiate the class in my lib.php within the function that actually needs it.

Fatal error: Class 'Illuminate\Console\Command' not found

I've been trying to run a cron task in my server using Laravel. The problem is that I'm getting this error every time.
Fatal error: Class 'Illuminate\Console\Command' not found
I've been trying running the composer install and composer dump-autoload, but nothing changes. I keep getting this error.
I have checked my vendor folder in Illuminate/Console/Command.php and everything is in the right place.
How can I solve it or what could be causing it?

PHP Fatal error: Class 'Sightengine\\SightengineClient' not found in

after trying different ways of using the API from sightengine I can' get it to work, I followed the instructions on their site , installing via composer, but when I try to use it, I get the Class not found error in apache:
PHP Fatal error: Uncaught Error: Class 'Sightengine\\SightengineClient' not found in /var/www/html/photobooth/app.php
PHP file:
<?php
use Sightengine\SightengineClient;
$client = new SightengineClient('xxxxxxx', 'xxxxxxxxx');
Missed to include the file.
When installing using composer, we have to include the file in our code
require_once 'vendor'.DIRECTORY_SEPARATOR.'autoload.php';
This will help you to include the file in code, so you can start using the class/objects

S3Client gives fatal error - Fatal error: Class 'Aws\Common\Client\AbstractClient' not found

I have aws sdk in current directory. I have included sdk in file like this..
include("Aws/S3/S3Client.php");
use Aws\S3\S3Client;
class myClass{
}
It gives me fatal error like..
Fatal error: Class 'Aws\Common\Client\AbstractClient' not found in /somePath/Aws/S3/S3Client.php on line 117
Please help.
To avoid all these error while sending request or getting response from AWS, set up AWS SDK using http://aws.amazon.com/developers/getting-started/php/, or use
git clone https://github.com/awslabs/aws-php-sample.git
curl -sS https://getcomposer.org/installer | php
php composer.phar install
By installing AWS SDK in this way, you'll get a file at vendor/autoload.php
It'll take care of all the required files into the script.
I had the exact same issue and wasn't able to find an answer anywhere. So, in case anyone has the same problem in the future, for me it was simply a matter of using a version of AWS SDK that was incompatible with my PHP version.
Once I upgraded my server's PHP version it all worked fine.

Paypal PHP SDK Not found! Fatal error: Class 'string' not found

I need to execute the phpsdk paypal samples on:
http://www.fastbreakplay.com/preview/paypal/sample/
but I get the following error:
Fatal error: Class 'string' not found in
/home/fastbre/public_html/preview/paypal/sample/vendor/paypal/rest-api-sdk-php/lib/PayPal/Common/Model.php
on line 53
The product you are using is rest-api-sdk-php
https://github.com/paypal/rest-api-sdk-php
If you look under issues, two days ago there
was an issue reported that may be related to
your problem.
https://github.com/paypal/rest-api-sdk-php/issues/4
As you can see in the issue, they had some
issues updating. That could have messed up
all kinds of things. They were suggesting
removing the vendor folder and
composer.lock files; then doing a composer update.
Since your problem was in the vendor directory, and
you may have been installing around the time of
this update issue, you may want to try their
suggestion.

Categories