301 Ping is a URL shortener. Create short links from the web app or authenticated API, then manage your links and track visits from your account.
- Create short links from the home page, with or without an account.
- Redirect short links to their destination and count visits.
- Register to manage your links and see link and visit totals on your dashboard.
- Create short links through the API using your account access token.
- Validate destination URLs before shortening.
- PHP 8.4+
- Composer
- Node.js and npm
- MySQL (or another database supported by Laravel)
-
Install PHP and JavaScript dependencies:
composer install npm ci
-
Create your environment file and application key:
cp .env.example .env php artisan key:generate
-
Configure the
DB_*values in.envfor your local database. The example environment uses MySQL; make sure the database exists, then run migrations:php artisan migrate
-
Start the Laravel server and Vite development server in separate terminals:
php artisan serve
npm run dev
The app is available at the URL printed by php artisan serve. To build production assets, run npm run build.
The API documentation is available at /documentation/api. To create a link, send a POST request to /api/shorten with a JSON url and your account access token:
curl --request POST \
--url "https://your-domain.example/api/shorten" \
--header "Authorization: Bearer <token>" \
--header "Content-Type: application/json" \
--data '{"url":"https://example.com/very/long/url"}'A successful request returns the short URL:
{
"status": true,
"message": "Shortened Url created successfully",
"short_url": "https://your-domain.example/abc123"
}The access token is available from your account dashboard. Requests without a valid token return 401; missing, invalid, or unsafe URLs return 422.
Run the test suite with:
php artisan test