I have installed CodeIgniter using downloaded zip file. I am trying to integrate google sign in in the application.
I have included the google-php-client using the code as below.
<?php namespace App\Controllers;
include_once(APPPATH.'Libraries/google-api-php-client/vendor/autoload.php');
include_once(APPPATH.'Libraries/google-api-php-client/src/Client.php');
use CodeIgniter\Controller;
use Google\Client;
class Account extends Controller{
When I run the application, the browser shows.
This page isn’t working right now localhost can't currently handle this request.
The php error log shows
[28-Dec-2024 10:26:17 UTC] PHP 15. include_once() D:\wamp64\www\michelm\system\Autoloader\Autoloader.php:317
[28-Dec-2024 10:26:17 UTC] PHP Fatal error: Uncaught Error: Class "CodeIgniter\Log\Logger" not found in D:\wamp64\www\michelm\system\Config\Services.php:405
It also shows
[28-Dec-2024 10:26:17 UTC] PHP Fatal error: Declaration of CodeIgniter\Log\Logger::emergency(Stringable|string $message, array $context = []): void must be compatible with Psr\Log\LoggerInterface::emergency($message, array $context = []) in D:\wamp64\www\michelm\system\Log\Logger.php on line 162
How to fix this.
There are installation steps shared at their GitHub page.
It tells you that you need PHP 8.0+, which I will presume in the space of this answer that you already absolve. The documentation offers you two possible approaches. The first one is to use Composer:
If you do not already have Composer installed, then read about the installation of Composer.
Once you have a properly operating composer, run this command in your project root:
composer require google/apiclient
If you experience timeouts, then you can adjust the timeout limitations, as the README explains with this example:
{
"config": {
"process-timeout": 600
}
}
Of course, the process-timeout
is to be tackled in the config section of the composer schema. Then make sure you include the autoloader:
require_once '/path/to/your-project/vendor/autoload.php';
You can pin the library to the latest version to prevent problems stemming from breaking changes. Read further about cleaning up unused libraries, it will probably be helpful for you to reduce the project requires to those that you actually need.
You can also download the release from the releases page and embed it into your repository.
You have a Logger
-related error. Let's make sure that 1. Your CodeIgniter worked before you started using Google API PHP Client and 2. That you have properly installed Google API PHP Client.
Once we can rely on these two statements as facts you will need to carefully read about CodeIgniter and Google API PHP Client compatibility. It is very much possible that a
composer update
will solve the issue. You can add something like
"psr/log": "^3.0"
to your composer.json's require
section.