PHP code example of richard-roman / short-links-qr
1. Go to this page and download the library: Download richard-roman/short-links-qr library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Marca el link como inactivo e invalida su caché de redirección.
ShortLinks::deactivate('k7mn2wxp');
// A partir de este momento GET /l/k7mn2wxp retorna 404.
// Rotación con código auto-generado
$nuevoLink = ShortLinks::rotate('codigo-viejo');
// Rotación con código manual
$nuevoLink = ShortLinks::rotate('codigo-viejo', 'codigo-nuevo');
// El nuevo link hereda: urlDestino, entidadTipo, entidadId, titulo, creadoPorId
echo $nuevoLink->codigo; // "codigo-nuevo"
use App\ShortLinks\Resolvers\EntregableEntityResolver;
use App\ShortLinks\Resolvers\ProyectoEntityResolver;
$this->app->tag([
ProyectoEntityResolver::class,
EntregableEntityResolver::class,
], 'short-links.entity-resolvers');
public function supports(string $entidadTipo): bool;
public function resolveUrl(string $entidadId): ?string;