Welcome Guest, Not a member yet? Register   Sign In
How use compser in Codeigniter
#11

(09-08-2019, 04:20 AM)omid_student Wrote:
(09-07-2019, 07:47 AM)Paradinight Wrote:
(09-07-2019, 07:21 AM)omid_student Wrote: My composer config is OK
I have problem only in Buzz or Firebase

I need an example code like this:
PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');
use \
Firebase\JWT\JWT;

class 
Test extends CI_Controller {

 public function 
index()
 {
 
$key "example_key";
 
$token = array(
 
"iss" => "http://example.org",
 
"aud" => "http://example.com",
 
"iat" => 1356999524,
 
"nbf" => 1357000000
 
);

 
$jwt JWT::encode($token$key);
 
$decoded JWT::decode($jwt$key, array('HS256'));

 
print_r($jwt);
 
print_r($decoded);
 }

This code works without error.

When i use require_once 'vendor/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php';
and remove use \Firebase\JWT\JWT;
That is working good
Why?
I used autoload already

You use the 2.x or less Version and not the 5 Smile
Reply
#12

(09-08-2019, 04:36 AM)Paradinight Wrote:
(09-08-2019, 04:20 AM)omid_student Wrote:
(09-07-2019, 07:47 AM)Paradinight Wrote:
(09-07-2019, 07:21 AM)omid_student Wrote: My composer config is OK
I have problem only in Buzz or Firebase

I need an example code like this:
PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');
use \
Firebase\JWT\JWT;

class 
Test extends CI_Controller {

 public function 
index()
 {
 
$key "example_key";
 
$token = array(
 
"iss" => "http://example.org",
 
"aud" => "http://example.com",
 
"iat" => 1356999524,
 
"nbf" => 1357000000
 
);

 
$jwt JWT::encode($token$key);
 
$decoded JWT::decode($jwt$key, array('HS256'));

 
print_r($jwt);
 
print_r($decoded);
 }

This code works without error.

When i use require_once 'vendor/firebase/php-jwt/Firebase/PHP-JWT/Authentication/JWT.php';
and remove use \Firebase\JWT\JWT;
That is working good
Why?
I used autoload already

You use the 2.x or less Version and not the 5 Smile

No it is OK
My problem solved with remove use \Firebase\JWT\JWT
Reply




Theme © iAndrew 2016 - Forum software by © MyBB