PHP Classes

PHP AJAX Login with JWT and Fetch API: Login users using AJAX to send JWT to a server API

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-12-05 (10 months ago) RSS 2.0 feedNot enough user ratingsTotal: 135 All time: 9,286 This week: 44Up
Version License PHP version Categories
ajax-login 1.0.0MIT/X Consortium ...7HTTP, Cryptography, User Management, W..., S..., A..., P...
Description 

Author

This package can log users in using AJAX to send JWT to a server API.

It implements a REST API to process requests on user accounts stored in a database on the server side.

The package provides code that uses the JavaScript Fetch API to send AJAX requests to server side API to perform several types of operations with user accounts.

It uses JWT (JSON Web Tokens) to send user authentication and authorization requests securely.

Login com Jwt, padrão MVC e REST - teste na URL abaixo, projeto criado para ensinar como gerenciar perfis distintos com arquitetura desacoplada

Innovation Award
PHP Programming Innovation award nominee
December 2023
Number 7
A JSON Web Token (JWT) is a text string with values encoded in the JSON format that stores values that may be signed using cryptography methods, so it can be used to transmit messages verified when the messages reach the destination.

Modern browsers already support the JavaScript Fetch API. Using this API, developers can use a more modern way to send asynchronous requests from browsers to an API running on the Web server side.

This package uses both JWT and the Fetch API to implement a user login and management system that can replace traditional systems that use XMLHttpRequest object support to send AJAX requests to a server-side API implemented in PHP to authenticate and authorize user access securely.

Manuel Lemos
Picture of Rodrigo Faustino
  Performance   Level  
Name: Rodrigo Faustino <contact>
Classes: 27 packages by
Country: Brazil Brazil
Age: 41
All time rank: 2509173 in Brazil Brazil
Week rank: 4 Up1 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 17x

Winner: 2x

Example

<?php
namespace App\Router;
require
"../../vendor/autoload.php";

use
App\Controller\PerfilPermissaoController;
use
App\Controller\UsuarioController;
use
App\Model\Perfil;
use
App\Model\Usuario;
use
App\Controller\PermissaoController;

use
Bramus\Router\Router;
$usuario = new Usuario();
$router = new Router();
$permitido = new PermissaoController();

   
// In case one is using PHP 5.4's built-in server
   
$filename = __DIR__ . preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
    if (
php_sapi_name() === 'cli-server' && is_file($filename)) {
    return
false;
}


   
$router->set404(function () {
       
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
        echo
'404, route not found!';
    });

 
   
$router->set404('/test(/.*)?', function () {
       
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
        echo
'<h1><mark>404, route not found!</mark></h1>';
    });

   
$router->set404('/api(/.*)?', function() {
       
header('HTTP/1.1 404 Not Found');
       
header('Content-Type: application/json');
       
$jsonArray = array();
       
$jsonArray['status'] = "404";
       
$jsonArray['status_text'] = "route not defined";
        echo
json_encode($jsonArray);
    });

 
   
$router->before('GET', '/.*', function () {
       
header('X-Powered-By: bramus/router');
    });
   
  
   
   
// GET token
   
$router->get('/token', function () {
       
$permitido = new PermissaoController();
       
$permitido->verToken();
    });
   
// Rota Login
   
$router->post('/login', function () {
       
$body = json_decode(file_get_contents('php://input'), true);
       
$usuario = new Usuario();
        if (isset(
$body['email'])) {
           
$usuario->setEmail($body['email']);
           
$senha=$body['senha'];
           
$lembrar=$body['lembrar'];
           
$usuariosController = new UsuarioController($usuario);
           
$resultado = $usuariosController->login($senha,$lembrar);
            if(!
$resultado['status']){
                echo
json_encode(['status' => $resultado['status'], 'message' => $resultado['message']]);
               exit;
            }
            echo
json_encode(['status' => $resultado['status'], 'message' => $resultado['message'],'token'=>$resultado['token']]);
            exit;
        }
    });
   
$router->post('/recuperarsenha', function () {
       
$body = json_decode(file_get_contents('php://input'), true);
       
$usuario = new Usuario();
        if (isset(
$body['email'])) {
           
$usuario->setEmail($body['email']);
           
$usuariosController = new UsuarioController($usuario);
           
$resultado = $usuariosController->recupasenha();
            if(!
$resultado['status']){
                echo
json_encode(['status' => $resultado['status'], 'message' => $resultado['message']]);
               exit;
            }
            echo
json_encode(['status' => $resultado['status'], 'message' => $resultado['message']]);
            exit;
        }
    });
   
// Todos metodos Usuarios
   
$router->mount('/Usuarios', function () use ($router) {
       
$router->get('/', function () {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
           
$usuario = new Usuario();
           
$usuariosController = new UsuarioController($usuario);
           
$resultado = $usuariosController->listarUsuarios();
            if(!
$resultado){
                echo
json_encode(["status" => false, "Usuarios" => $resultado,"mensagem"=>"nenhum resultado encontrado"]);
                exit;
            }else{
                echo
json_encode(["status" => true, "Usuarios" => $resultado]);
                exit;
            }
        });

       
$router->get('/(\d+)', function ($id) {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
           
$usuario = new Usuario();
           
$usuariosController = new UsuarioController($usuario);
           
$resultado = $usuariosController->buscarPorId($id);
                if(!
$resultado){
                    echo
json_encode(["status" => false, "Usuarios" => $resultado,"mensagem"=>"nenhum resultado encontrado"]);
                    exit;
                }else{
                    echo
json_encode(["status" => true, "Usuario" => $resultado]);
                    exit;
                }
        });

       
$router->put('/(\d+)', function ($id) {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
            echo
'Update usuario id ' . htmlentities($id);
        });
       
$router->post('/Registrar', function () {
           
$body = json_decode(file_get_contents('php://input'), true);
           
$usuario = new Usuario();
           
$usuario->setNome($body['nome']);
           
$usuario->setEmail($body['email']);
           
$usuario->setSenha($body['senha']);
           
$usuario->setPerfilId(2);
           
$usuariosController = new UsuarioController($usuario);
           
$resultado = $usuariosController->adicionarUsuario();
            echo
json_encode(['status' => $resultado]);
        });
    });
   
$router->get('/Perfil', function () {
       
$permitido = new PermissaoController();
       
$permitido->autorizado();
       
$controller = new PerfilPermissaoController();
           
$resultado = $controller->listarTodos();
            if (!
$resultado) {
                echo
json_encode(["status" => false, "mensagem" => "Nenhum perfil encontrado"]);
                exit;
            } else {
                echo
json_encode($resultado);
                exit;
            }
    });
   
// Todos metodos Permissao
   
$router->mount('/Permissao', function () use ($router) {
       
$router->get('/', function () {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
           
$controller = new PerfilPermissaoController();
           
$resultado = $controller->listarPermissoes();
            if (!
$resultado) {
                echo
json_encode(["status" => false, "mensagem" => "Nenhuma permissao encontrado"]);
                exit;
            } else {
                echo
json_encode($resultado);
                exit;
            }
        });

       
$router->get('/(\d+)', function ($id) {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
           
$perfil = new Perfil();
           
$perfil->setId($id);
           
$controller = new PerfilPermissaoController();
           
$resultado = $controller->obterPermissoesDoPerfil($perfil);
            if (!
$resultado) {
                echo
json_encode(["status" => false, "mensagem" => "Nenhum resultado encontrado"]);
                exit;
            } else {
                echo
json_encode($resultado);
                exit;
            }
        });
       
$router->post('/', function () {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
           
$body = json_decode(file_get_contents('php://input'), true);
           
$perfil = new Perfil();
           
$controller = new PerfilPermissaoController();
           
$perfil->setId($body['perfilId']);
           
$resultado = $controller->adicionarPermissao($perfil, $body['nome']);
            echo
json_encode(['status' => $resultado]);
        });
       
$router->put('/(\d+)', function ($id) {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
            echo
'Update usuario id ' . htmlentities($id);
        });
       
$router->delete('/(\d+)', function ($id) {
           
$permitido = new PermissaoController();
           
$permitido->autorizado();
           
$controller = new PerfilPermissaoController();
           
$perfil = new Perfil();
           
$body = json_decode(file_get_contents('php://input'), true);
           
$perfil->setId($id);
           
$resultado = $controller->removerPermissao($perfil, $body['nome']);
            echo
json_encode(['status' => $resultado]);
        });
    });

   
$router->run();

// EOF


Details

Sistema de Login com JWT

Sistema de autenticação simples utilizando JSON Web Tokens (JWT).

Requisitos

  • PHP
  • Biblioteca `firebase/php-jwt`

Instalação

Clone o repositório depois instale a dependencia abaixo Instale a biblioteca via composer:

composer require firebase/php-jwt
composer require bramus/router
composer update

Uso

Após a instalçao das dependências acima mencionadas, uma para gerenciar a criação e validação do token, a outra é para gerenciar rotas semelhante o que acontece com os principais frameworks, onde é capturado o metodo e o recurso e direciona para a função no contralador especifico.

Login

Ao realizar o login, um token JWT é gerado para o usuário com base em suas credenciais. o frontend recebe o token caso a autenticação seja bem sucedida, e o javascript "x.js" a cada 1 minuto faz uma requisição para verificar o token e verificar as telas autorizadas pela passoa logada.

$key = "YOUR_SECRET_KEY";
$payload = [
 "iss" => "localhost",
 "aud" => "localhost",
 "iat" => time(),
 "exp" => time() + 3600,  // Expira em 1 hora
 "sub" => "user@email.com"
];

$jwt = JWT::encode($payload, $key);

Validação de Token Para validar o token recebido em requisições subsequentes:

$key = "YOUR_SECRET_KEY";

try {
    $decoded = JWT::decode($token, $key, ['HS256']);
    // Token é válido
} catch(Exception $e) {
    // Token inválido
}

Estrutura do Projeto

backend/Controller/UsuarioController.php: Contém a lógica para gerar e validar o JWT. backend/Router/: Roteamento e processamento das requisições HTTP.

Como Usar

  • Login Para fazer login, envie uma requisição POST para backend/Router/ com os campos email e senha. Se for bem-sucedido, você receberá um JWT que será usado para futuras autenticações, salvando em sessionStorage.
    const response = await fetch(urlBase+'backend/Router/login', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ email, senha: password,lembrar })
    });
    const data = await response.json();
    if (data.status) {
        sessionStorage.setItem('token', data.token);
        window.location.href = "index.html"; 
    }
  • Validar Token Para validar o token, envie uma requisição GET para backend/Router/loginRouter.php com o token no cabeçalho de Autorização. O token será validado e, se ainda estiver válido, a resposta será positiva.

Bônus (recursos adicionais)

  • Os javascripts cards e times fazem uma busca fetch para um json que está estruturado, e o javascript ler o conteúdo e monta os cards, essa parte foi criada para mostrar a manipulação do DOM sem um banco de dados

  Files folder image Files (154)  
File Role Description
Files folder imagebackend (2 files, 5 directories)
Files folder imagecss (2 files)
Files folder imageimg (7 files)
Files folder imagejs (8 files, 1 directory)
Files folder imagesql (1 file)
Files folder imagevendor (1 file, 4 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file esqueci.html Data HTML page
Accessible without login Plain text file index.html Data HTML page
Accessible without login Plain text file login.html Data HTML page
Accessible without login Plain text file pessoas.html Data HTML page
Accessible without login Plain text file projetos.html Data HTML page
Accessible without login Plain text file readme.md Doc. Documentation
Accessible without login Plain text file registrar.html Data HTML page

  Files folder image Files (154)  /  backend  
File Role Description
Files folder imageController (4 files)
Files folder imageCryptonita (1 file)
Files folder imageDatabase (5 files)
Files folder imageModel (3 files)
Files folder imageRouter (5 files)
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (154)  /  backend  /  Controller  
File Role Description
  Plain text file EnviaEmail.php Class Class source
  Plain text file PerfilPermissaoController.php Class Class source
  Plain text file PermissaoController.php Class Class source
  Plain text file UsuarioController.php Class Class source

  Files folder image Files (154)  /  backend  /  Cryptonita  
File Role Description
  Plain text file Crypto.php Class Class source

  Files folder image Files (154)  /  backend  /  Database  
File Role Description
  Accessible without login Plain text file banco_x.sqbpro Data Auxiliary data
  Accessible without login Plain text file config.php Aux. Auxiliary script
  Accessible without login Plain text file configEmail.php Aux. Auxiliary script
  Plain text file Connection.php Class Class source
  Plain text file Crud.php Class Class source

  Files folder image Files (154)  /  backend  /  Model  
File Role Description
  Plain text file Perfil.php Class Class source
  Plain text file Permissao.php Class Class source
  Plain text file Usuario.php Class Class source

  Files folder image Files (154)  /  backend  /  Router  
File Role Description
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file LoginRouter.php Example Example script
  Accessible without login Plain text file PerfilPermissaoRouter.php Example Example script
  Accessible without login Plain text file PermissaoRouter.php Example Example script
  Accessible without login Plain text file UsuarioRouter.php Example Example script

  Files folder image Files (154)  /  css  
File Role Description
  Accessible without login Plain text file styleaTime.css Data Auxiliary data
  Accessible without login Plain text file w3.css Data Auxiliary data

  Files folder image Files (154)  /  img  
File Role Description
  Accessible without login Image file 1.png Icon Image
  Accessible without login Image file 2.png Icon Image
  Accessible without login Image file 3.png Icon Image
  Accessible without login Image file img_avatar4.png Icon Image
  Accessible without login Image file team1.jpg Photo Team member image
  Accessible without login Image file team2.jpg Photo Team member image
  Accessible without login Image file team3.jpg Photo Team member image

  Files folder image Files (154)  /  js  
File Role Description
Files folder imagejson (2 files)
  Accessible without login Plain text file cards.js Data Auxiliary data
  Accessible without login Plain text file esqueci.js Data Auxiliary data
  Accessible without login Plain text file gerenciar.js Data Auxiliary data
  Accessible without login Plain text file getUsers.js Data Auxiliary data
  Accessible without login Plain text file login.js Data Auxiliary data
  Accessible without login Plain text file registrar.js Data Auxiliary data
  Accessible without login Plain text file times.js Data Auxiliary data
  Accessible without login Plain text file token.js Data Auxiliary data

  Files folder image Files (154)  /  js  /  json  
File Role Description
  Accessible without login Plain text file cards.json Data Auxiliary data
  Accessible without login Plain text file times.json Data Auxiliary data

  Files folder image Files (154)  /  sql  
File Role Description
  Accessible without login Plain text file banco.sql Data Auxiliary data

  Files folder image Files (154)  /  vendor  
File Role Description
Files folder imagebramus (1 directory)
Files folder imagecomposer (11 files)
Files folder imagefirebase (1 directory)
Files folder imagephpmailer (1 directory)
  Accessible without login Plain text file autoload.php Aux. Auxiliary script

  Files folder image Files (154)  /  vendor  /  bramus  
File Role Description
Files folder imagerouter (6 files, 5 directories)

  Files folder image Files (154)  /  vendor  /  bramus  /  router  
File Role Description
Files folder image.github (1 directory)
Files folder imagedemo-multilang (2 files)
Files folder imagedemo (2 files)
Files folder imagesrc (1 directory)
Files folder imagetests (2 files)
  Accessible without login Plain text file .php_cs.dist Example Example script
  Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file LICENSE Lic. License text
  Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file CI.yml Data Auxiliary data

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  demo-multilang  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file index.php Class Class source

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  demo  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  src  
File Role Description
Files folder imageBramus (1 directory)

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  src  /  Bramus  
File Role Description
Files folder imageRouter (1 file)

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  src  /  Bramus  /  Router  
File Role Description
  Plain text file Router.php Class Class source

  Files folder image Files (154)  /  vendor  /  bramus  /  router  /  tests  
File Role Description
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file RouterTest.php Class Class source

  Files folder image Files (154)  /  vendor  /  composer  
File Role Description
  Accessible without login Plain text file autoload_classmap.php Aux. Auxiliary script
  Accessible without login Plain text file autoload_namespaces.php Aux. Auxiliary script
  Accessible without login Plain text file autoload_psr4.php Aux. Auxiliary script
  Plain text file autoload_real.php Class Class source
  Plain text file autoload_static.php Class Class source
  Plain text file ClassLoader.php Class Class source
  Accessible without login Plain text file installed.json Data Auxiliary data
  Accessible without login Plain text file installed.php Aux. Auxiliary script
  Plain text file InstalledVersions.php Class Class source
  Accessible without login Plain text file LICENSE Lic. License text
  Accessible without login Plain text file platform_check.php Aux. Auxiliary script

  Files folder image Files (154)  /  vendor  /  firebase  
File Role Description
Files folder imagephp-jwt (4 files, 1 directory)

  Files folder image Files (154)  /  vendor  /  firebase  /  php-jwt  
File Role Description
Files folder imagesrc (8 files)
  Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file LICENSE Lic. License text
  Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (154)  /  vendor  /  firebase  /  php-jwt  /  src  
File Role Description
  Plain text file BeforeValidException.php Class Class source
  Plain text file CachedKeySet.php Class Class source
  Plain text file ExpiredException.php Class Class source
  Plain text file JWK.php Class Class source
  Plain text file JWT.php Class Class source
  Plain text file JWTExceptionWithPayloadInterface.php Class Class source
  Plain text file Key.php Class Class source
  Plain text file SignatureInvalidException.php Class Class source

  Files folder image Files (154)  /  vendor  /  phpmailer  
File Role Description
Files folder imagephpmailer (7 files, 2 directories)

  Files folder image Files (154)  /  vendor  /  phpmailer  /  phpmailer  
File Role Description
Files folder imagelanguage (53 files)
Files folder imagesrc (7 files)
  Accessible without login Plain text file COMMITMENT Data Auxiliary data
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file get_oauth_token.php Example Example script
  Accessible without login Plain text file LICENSE Lic. License text
  Accessible without login Plain text file README.md Example Example script
  Accessible without login Plain text file SECURITY.md Data Auxiliary data
  Accessible without login Plain text file VERSION Data Auxiliary data

  Files folder image Files (154)  /  vendor  /  phpmailer  /  phpmailer  /  language  
File Role Description
  Accessible without login Plain text file phpmailer.lang-af.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ar.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-az.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ba.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-be.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-bg.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ca.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-cs.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-da.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-de.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-el.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-eo.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-es.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-et.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-fa.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-fi.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-fo.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-fr.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-gl.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-he.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-hi.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-hr.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-hu.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-hy.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-id.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-it.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ja.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ka.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ko.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-lt.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-lv.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-mg.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-mn.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ms.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-nb.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-nl.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-pl.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-pt.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-pt_br.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ro.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-ru.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-si.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-sk.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-sl.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-sr.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-sr_latn.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-sv.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-tl.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-tr.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-uk.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-vi.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-zh.php Aux. Auxiliary script
  Accessible without login Plain text file phpmailer.lang-zh_cn.php Aux. Auxiliary script

  Files folder image Files (154)  /  vendor  /  phpmailer  /  phpmailer  /  src  
File Role Description
  Plain text file DSNConfigurator.php Class Class source
  Plain text file Exception.php Class Class source
  Plain text file OAuth.php Class Class source
  Plain text file OAuthTokenProvider.php Class Class source
  Plain text file PHPMailer.php Class Class source
  Plain text file POP3.php Class Class source
  Plain text file SMTP.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:135
This week:0
All time:9,286
This week:44Up