• Czas czytania ~1 min
  • 25.08.2022

Krótki adres URL autorstwa Ash Allen to pakiet Laravel do tworzenia skróconych adresów URL w aplikacjach Laravela. Aby rozpocząć, możesz łatwo utworzyć nowy krótki adres URL za pomocą następującego kodu:

use AshAllenDesign\ShortURL\Classes\Builder;
 
$builder = new Builder();
 
$shortURLObject = $builder->destinationUrl('https://destination.com')->make();
$shortURL = $shortURLObject->default_short_url;

Do Ciebie należy konfiguracja i tworzenie krótkich adresów URL wokół istniejących danych;na przykład możesz wygenerować krótki adres URL po opublikowaniu nowego modelu postu.

Ten pakiet zapewnia wszystkie podstawy i szereg zaawansowanych funkcji, aby rozpocząć tworzenie krótkich, udostępniane adresy URL dla Twoich aplikacji. Jego główne funkcje to:

  • Custom URL Keys
  • Single-use short URLs
  • Enforce HTTPS
  • Configure redirect status code (302 found instead of 301 permanent)
  • Make a short URL active and inactive on a certain date
  • Track Visitors:
    • IP Address
    • Browser Name
    • Browser Version
    • Operating System Name
    • Operating System Version
    • Referrer URL (the URL that the visitor originally came from)
    • Device Type (can be: desktop/mobile/tablet/robot)

Oto więcej przykładów pracy z istniejącymi instancjami modelu ShortURL z pliku README:

use \AshAllenDesign\ShortURL\Models\ShortURL;
 
// Find URL by key
$shortURL = ShortURL::findByKey('abc123');
 
// Find by destination
$shortURLs = ShortURL::findByDestinationURL('https://destination.com');
 
// Enable tracking to an existing short URL instance
$shortURL->trackingEnabled();
 
// Get model properties, such as visits
$shortURL = ShortURL::find(1);
$visits = $shortURL->visits;
 
// Single-use short URL
$builder = new \AshAllenDesign\ShortURL\Classes\Builder();
 
$shortURLObject = $builder
    ->destinationUrl('https://destination.com')
    ->singleUse()
    ->make();
< h2>Więcej informacji

Możesz dowiedzieć się więcej o tym pakiecie, uzyskać pełne instrukcje instalacji i wyświetlić kod źródłowy na GitHub. README zawiera pełną dokumentację ze wszystkim, czego potrzebujesz do skonfigurowania i uruchomienia interakcja z krótkimi adresami URL.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

O

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

O autorze CrazyBoy49z
WORK EXPERIENCE
Kontakt
Ukraine, Lutsk
+380979856297