Class Firebase\JWT\JWT not found
As per the documentation, you need to include the autoloader.
E.g., in your php file:
require __DIR__ . '/vendor/autoload.php';
But... typically your vendor
folder would be at the same level than your html
folder (the one where you are serving content).
E.g.:
- Project root
--- vendor
--- html
----- index.php
Then in your index.php you'd do:
require __DIR__ . '/../vendor/autoload.php';
It is nice that you trying to use composer and modules, but if I were you I'd try to read on a bit about php's autoloading features, so you understand what's going on, and how you can profit from them.
Class 'JWT' not found
Yup my code is now working when I add
use \Firebase\JWT\JWT
in my user.php file instead of the index.php.
Thanks @jumper85 for your answer.
Error : Class 'Firebase\JWT\SignatureInvalidException' not found
I think you have to require_once
signature before JWT.php
file will be something like this in codeigniter libraries.
class SignatureInvalidException extends \UnexpectedValueException
{
}
Error when creating token with JWT
If you copied the file from GitHub rather than using composer to install it, you will need to comment out the namespace lines at the top of the file. so from my snapshot at the very top of the first line of jwt.php
screenshot, you will comment out //namespace Firebase\JWT;
and you would not get the 500 internal server error again.
Related Topics
PHP MySQL SQL Parser (Insert and Update)
Call PHP from JavaScript and Return an Array from PHP to JavaScript Function
Create a Insert... Select Statement in Laravel
How to Get the Current PHP Executable from Within a Script
How to Solve "Non-Static Method Xxx:Xxx() Should Not Be Called Statically in PHP 5.4
Read the Longest String from an Array in PHP 5.3
Can a PHP Function Accept an Unlimited Number of Parameters
Serial Comm with PHP on Windows
How to Detect If Your Website Visitor Came from a Google Search Result
How to Parse HTML Table Using PHP
How to Pass Parameters from Bash to PHP Script
Processing Multidimensional JSON Array with PHP
How to Add a Condition Inside a PHP Array
Rewrite All Queries to Not Need the .PHP Extension Using a Mod_Rewrite Rewriterule