Reputation: 11
To verify users for firebase I want to use https://github.com/firebase/firebase-token-generator-php which depends on https://github.com/firebase/php-jwt But how to install? I've checked out both resources in 'libs/firebase-token-generator-php' respectively 'libs/php-jwt'
The problem:
"firebase-token-generator-php" uses include_once 'JWT.php';
and that's neither in the same folder nor in my include path.
It would really be easier if I could use composer for that.
Upvotes: 1
Views: 4409
Reputation: 159
Edit your composer.json as in this example:
{
"name": "example/firechat",
"type": "project",
},
"require": {
"php": ">=5.4",
"composer/installers": "v1.0.12",
"firebase/php-jwt": "*",
"firebase/token-generator": "*"
}
}
Include the libs in your installation, eg:
include_once ABSPATH . 'vendor/autoload.php';
Use the libs in your code, eg:
$tokenGen = new \Services_FirebaseTokenGenerator( "#great-token-from-firebase-app-manager#" );
$token = $tokenGen->createToken( array( "uid" => 'custom:1'), array( "admin" => true ) );
Upvotes: 1
Reputation: 29482
Both of these are PEAR packages, so you can download tgz files and install them by PEAR. This way they will be added into your include path.
Other way you have, is to add libs/php-jwt
to your include path manually (in ini file or using set_include_path
)
Upvotes: 0