gmail PHP api - sample code to setvacation in code igniter

I originally used [login to view URL] and added to codeigniter via composer. You can see the getClient function from there.

I have the following sample code I made which retrieves Gmail vacation response. As you can see, I update an element of the object to change the subject and attempt to send it back to gmail. It throws an error.

What I need is an example of how to set the subject, message, start and end date of the vacation autoresponder. Below is my broken attempt

public function setVacation($userToken)


// Get the API client and construct the service object.

$client = $this->getClient($userToken);

$service = new Google_Service_Gmail($client);

// get the vacation settings

$user = 'me';

$results = $service->users_settings->getVacation($user);


// works to here

// ============

// change the subject of the out of office as a test

$results->responseSubject = 'Out of Office.';

$results2 = $service->users_settings->updateVacation($user,$vacation);



This throws the error.

A PHP Error was encountered

Severity: 4096

Message: Argument 2 passed to Google_Service_Gmail_Resource_UsersSettings::updateVacation() must be an instance of Google_Service_Gmail_VacationSettings, null given, called in .....

Skills: Codeigniter, PHP

See more: gmail api php send email, google-api-php-client codeigniter, google authentication api php example, google_client.php download, google calendar api php github, google plus api php, gmail api php example, gmail api php github, php sql sample code, php mysql sample code, shoppingcom php api sample code, sample cold fusion code ebay api, aspnet youtube api sample code, enom api sample php, webex api sample code design, php xmlreader sample code, twitpic api sample php, free sample online exam code php, plesk api sample code vba, code php login gmail php

About the Employer:
( 2 reviews ) Sheffield, United Kingdom

Project ID: #18008157

Awarded to:


"I CAN DO THIS EASILY WITHIN 3 HOURS" I am Full Stack Developer and Expert Designer, having expertise in web development, web UI/UX, Mobile App Development and Designing. Wordpress, Joomla, Magento including payment ga More

$30 USD in 0 days
(31 Reviews)

11 freelancers are bidding on average $36 for this job


Dear Client , We are Really interested to do work with you , We are Web & Software development company having more than 6 year experience in Software development we totally committed to quality service, Transparen More

$50 USD in 1 day
(91 Reviews)

Hello, Hope you will be doing well!! I have read your description and I understand your requirement and I can handle your project. Please discuss with me for more clarification. Thanks

$45 USD in 1 day
(88 Reviews)

Hello hiring member i hope you are doing well i am bhavika i have 2.5+years experience in php , laravel , ajax,jquery , javascript , ajax,jquery html,css , bootstrap so i can do it so please give me chance to serve you More

$30 USD in 1 day
(86 Reviews)

Hello Sir, I've reviewed your requirement and I'm ready to work with you.I have almost 11+ years of experience in web development. I will provide quality work as well full support for any query. Kindly contact m More

$50 USD in 0 days
(156 Reviews)

I have been successfully working in the field of Application Development, Web Development & Mobile development. Working as a Full time Freelancer, I also have a small team of five Developers and provide services More

$30 USD in 2 days
(6 Reviews)

Hi, I have read through your job descriptions, and I understand all of the requirements. I am applying because I believe that I have the required skill set to complete your project. I have been working as a PHP deve More

$25 USD in 1 day
(11 Reviews)
$25 USD in 1 day
(10 Reviews)

I , am having huge experience to take up challenges in the virtual world of internet .I offer complete web solutions including internet/Online marketing Product Vedios,Blog ,Content writing ,Copy Writing ,Email Market More

$25 USD in 1 day
(0 Reviews)

Hi, Ready to start the work. kindly share the required details so that i can start the work asap. If you have any other queries let me know. Thanks Arit

$30 USD in 1 day
(0 Reviews)

Hi, I am Senior Web developer with the experience of seven years in IT industry (Web Development+Mobile App Design & Development, CMS development and much more). The website will be serviced as: -Pixel perfe More

$55 USD in 1 day
(0 Reviews)