Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (163) | Download .zip | Reputation | Support forum | Blog (1) | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2021-10-26 (24 days ago) | Not yet rated by the users | Total: 123 This week: 57 | All time: 9,273 This week: 2 |
Version | License | PHP version | Categories | |||
ushort 1.0 | The PHP License | 7 | HTTP, PHP 5, Web services |
Description | Author | |||
This package provides an API to create and expand short URLs. Innovation Award
|
Requirements:
clone the project from the Github repository, enter the project folder, open a terminal inside the project folder and run:
composer install
npm install
npm run dev
You need to create your .env file; inside the project folder run the following command:
cp .env.example .env
then setup your db schema and db credentials into the .env file and create the database using your favorite method (phpMyAdmin, MySQL Workbench, etc).
NOTE: It is very important to put inside your .env file, in the APP_URL key, the url that you are using to execute this project. For example, if you use the web server that comes with Laravel, when running 'php artisan serve', that url will usually be 'http://127.0.0.1:8000'; however, if you use a web server like Xampp or Laragon and create a virtual host, you must put the url of the virtual host that you created.
After that you need to create the database tables and populate them with data by running:
php artisan migrate --seed
After that, a default user is created with the following credentials:
User: admin
Email: admin@admin.com
Pswrd: password
This will generate a short url that points to the provided real url, you need to send a GET request with a json body as follows:
{
"url" : "your-real-url-here"
}
if succeed, the request will respond with a json body as follows:
{
"short_url" : "generated-short-url-here"
}
This will generate a Json array with the top 100 most visited Urls, you need to send a GET request without a body
This will respond with the real Url that the provided short url points to, you need to send a GET request with a json body as follows:
{
"url" : "your-short-url-here"
}
if succeed, the request will respond with a json body as follows:
{
"real_url" : "your-real-url-here"
}
In this project I show how to work with:
- Creating an API - Fetching an API - Livewire components - Livewire modals
- To have separate and related tables since the same real URL could have several short URLs associated with it. This would also help in scalability of the application and in integration with other systems. - Create a token-based authentication for the API; this way, requests to the API could be limited in a free subscription model and have another paid subscription model with unlimited requests. - Create a pagination for the Top 100 URLs view.
Files |
File | Role | Description | ||
---|---|---|---|---|
app (7 directories) | ||||
bootstrap (1 file) | ||||
config (17 files) | ||||
database (3 directories) | ||||
public (5 files, 2 directories) | ||||
resources (5 directories) | ||||
routes (4 files) | ||||
tests (2 files, 2 directories) | ||||
.editorconfig | Data | Auxiliary data | ||
.env.example | Data | Auxiliary data | ||
.styleci.yml | Data | Auxiliary data | ||
artisan | Class | Class source | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
package-lock.json | Data | Auxiliary data | ||
package.json | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
server.php | Aux. | Auxiliary script | ||
tailwind.config.js | Data | Auxiliary data | ||
webpack.mix.js | Data | Auxiliary data |
Files | / | app |
Files | / | app | / | Actions | / | Fortify |
File | Role | Description |
---|---|---|
CreateNewUser.php | Class | Class source |
PasswordValidationRules.php | Class | Class source |
ResetUserPassword.php | Class | Class source |
UpdateUserPassword.php | Class | Class source |
UpdateUserProfileInformation.php | Class | Class source |
Files | / | app | / | Http |
File | Role | Description | ||
---|---|---|---|---|
Controllers (2 files, 1 directory) | ||||
Livewire (1 file) | ||||
Middleware (8 files) | ||||
Kernel.php | Class | Class source |
Files | / | app | / | Http | / | Controllers |
File | Role | Description | ||
---|---|---|---|---|
Api (1 file) | ||||
Controller.php | Class | Class source | ||
RedirectionController.php | Class | Class source |
Files | / | app | / | Http | / | Middleware |
File | Role | Description |
---|---|---|
Authenticate.php | Class | Class source |
EncryptCookies.php | Class | Class source |
PreventRequestsDuringMaintenance.php | Class | Class source |
RedirectIfAuthenticated.php | Class | Class source |
TrimStrings.php | Class | Class source |
TrustHosts.php | Class | Class source |
TrustProxies.php | Class | Class source |
VerifyCsrfToken.php | Class | Class source |
Files | / | app | / | Providers |
File | Role | Description |
---|---|---|
AppServiceProvider.php | Class | Class source |
AuthServiceProvider.php | Class | Class source |
BroadcastServiceProvider.php | Class | Class source |
EventServiceProvider.php | Class | Class source |
FortifyServiceProvider.php | Class | Class source |
JetstreamServiceProvider.php | Class | Class source |
RouteServiceProvider.php | Class | Class source |
Files | / | app | / | View | / | Components |
File | Role | Description |
---|---|---|
AppLayout.php | Class | Class source |
GuestLayout.php | Class | Class source |
Files | / | config |
File | Role | Description |
---|---|---|
app.php | Class | Class source |
auth.php | Class | Class source |
broadcasting.php | Aux. | Auxiliary script |
cache.php | Aux. | Auxiliary script |
cors.php | Aux. | Auxiliary script |
database.php | Aux. | Auxiliary script |
filesystems.php | Aux. | Auxiliary script |
fortify.php | Aux. | Auxiliary script |
hashing.php | Aux. | Auxiliary script |
jetstream.php | Aux. | Auxiliary script |
logging.php | Class | Class source |
mail.php | Aux. | Auxiliary script |
queue.php | Aux. | Auxiliary script |
sanctum.php | Class | Class source |
services.php | Aux. | Auxiliary script |
session.php | Aux. | Auxiliary script |
view.php | Aux. | Auxiliary script |
Files | / | database | / | factories |
File | Role | Description |
---|---|---|
UrlFactory.php | Class | Class source |
UserFactory.php | Class | Class source |
Files | / | database | / | migrations |
File | Role | Description |
---|---|---|
2014_10_12_000000_create_users_table.php | Class | Class source |
2014_10_12_100000_...rd_resets_table.php | Class | Class source |
2014_10_12_200000_..._to_users_table.php | Class | Class source |
2019_08_19_000000_...iled_jobs_table.php | Class | Class source |
2019_12_14_000001_...ss_tokens_table.php | Class | Class source |
2021_10_14_212934_create_urls_table.php | Class | Class source |
2021_10_16_162118_..._sessions_table.php | Class | Class source |
Files | / | public |
File | Role | Description | ||
---|---|---|---|---|
css (1 file) | ||||
js (1 file) | ||||
.htaccess | Data | Auxiliary data | ||
index.php | Class | Class source | ||
mix-manifest.json | Data | Auxiliary data | ||
robots.txt | Doc. | Documentation | ||
web.config | Data | Auxiliary data |
Files | / | resources |
Files | / | resources | / | js |
File | Role | Description |
---|---|---|
app.js | Data | Auxiliary data |
bootstrap.js | Data | Auxiliary data |
Files | / | resources | / | lang | / | en |
File | Role | Description |
---|---|---|
auth.php | Aux. | Auxiliary script |
pagination.php | Aux. | Auxiliary script |
passwords.php | Aux. | Auxiliary script |
validation.php | Aux. | Auxiliary script |
Files | / | resources | / | views |
File | Role | Description | ||
---|---|---|---|---|
api (2 files) | ||||
auth (7 files) | ||||
layouts (2 files) | ||||
livewire (1 file) | ||||
profile (6 files) | ||||
vendor (1 directory) | ||||
dashboard.blade.php | Aux. | Auxiliary script | ||
navigation-menu.blade.php | Aux. | Auxiliary script | ||
policy.blade.php | Aux. | Auxiliary script | ||
terms.blade.php | Aux. | Auxiliary script | ||
top-url.blade.php | Aux. | Auxiliary script | ||
welcome.blade.php | Aux. | Auxiliary script |
Files | / | resources | / | views | / | api |
File | Role | Description |
---|---|---|
api-token-manager.blade.php | Aux. | Auxiliary script |
index.blade.php | Aux. | Auxiliary script |
Files | / | resources | / | views | / | auth |
File | Role | Description |
---|---|---|
confirm-password.blade.php | Aux. | Auxiliary script |
forgot-password.blade.php | Aux. | Auxiliary script |
login.blade.php | Aux. | Auxiliary script |
register.blade.php | Aux. | Auxiliary script |
reset-password.blade.php | Aux. | Auxiliary script |
two-factor-challenge.blade.php | Aux. | Auxiliary script |
verify-email.blade.php | Aux. | Auxiliary script |
Files | / | resources | / | views | / | layouts |
File | Role | Description |
---|---|---|
app.blade.php | Aux. | Auxiliary script |
guest.blade.php | Aux. | Auxiliary script |
Files | / | resources | / | views | / | profile |
File | Role | Description |
---|---|---|
delete-user-form.blade.php | Aux. | Auxiliary script |
logout-other-brows...ions-form.blade.php | Aux. | Auxiliary script |
show.blade.php | Aux. | Auxiliary script |
two-factor-authentication-form.blade.php | Aux. | Auxiliary script |
update-password-form.blade.php | Aux. | Auxiliary script |
update-profile-inf...tion-form.blade.php | Aux. | Auxiliary script |
Files | / | resources | / | views | / | vendor | / | jetstream |
File | Role | Description | ||
---|---|---|---|---|
components (28 files) | ||||
mail (1 file) |
Files | / | resources | / | views | / | vendor | / | jetstream | / | components |
File | Role | Description |
---|---|---|
action-message.blade.php | Aux. | Auxiliary script |
action-section.blade.php | Aux. | Auxiliary script |
application-logo.blade.php | Aux. | Auxiliary script |
application-mark.blade.php | Aux. | Auxiliary script |
authentication-card-logo.blade.php | Aux. | Auxiliary script |
authentication-card.blade.php | Aux. | Auxiliary script |
banner.blade.php | Aux. | Auxiliary script |
button.blade.php | Aux. | Auxiliary script |
checkbox.blade.php | Aux. | Auxiliary script |
confirmation-modal.blade.php | Aux. | Auxiliary script |
confirms-password.blade.php | Aux. | Auxiliary script |
danger-button.blade.php | Aux. | Auxiliary script |
dialog-modal.blade.php | Aux. | Auxiliary script |
dropdown-link.blade.php | Aux. | Auxiliary script |
dropdown.blade.php | Aux. | Auxiliary script |
form-section.blade.php | Aux. | Auxiliary script |
input-error.blade.php | Aux. | Auxiliary script |
input.blade.php | Aux. | Auxiliary script |
label.blade.php | Aux. | Auxiliary script |
modal.blade.php | Aux. | Auxiliary script |
nav-link.blade.php | Aux. | Auxiliary script |
responsive-nav-link.blade.php | Aux. | Auxiliary script |
secondary-button.blade.php | Aux. | Auxiliary script |
section-border.blade.php | Aux. | Auxiliary script |
section-title.blade.php | Aux. | Auxiliary script |
switchable-team.blade.php | Aux. | Auxiliary script |
validation-errors.blade.php | Aux. | Auxiliary script |
welcome.blade.php | Aux. | Auxiliary script |
Files | / | resources | / | views | / | vendor | / | jetstream | / |
File | Role | Description |
---|---|---|
team-invitation.blade.php | Aux. | Auxiliary script |
Files | / | routes |
File | Role | Description |
---|---|---|
api.php | Class | Class source |
channels.php | Example | Example script |
console.php | Example | Example script |
web.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
Feature (14 files) | ||||
Unit (1 file) | ||||
CreatesApplication.php | Class | Class source | ||
TestCase.php | Class | Class source |
Files | / | tests | / | Feature |
File | Role | Description |
---|---|---|
ApiTokenPermissionsTest.php | Class | Class source |
AuthenticationTest.php | Class | Class source |
BrowserSessionsTest.php | Class | Class source |
CreateApiTokenTest.php | Class | Class source |
DeleteAccountTest.php | Class | Class source |
DeleteApiTokenTest.php | Class | Class source |
EmailVerificationTest.php | Class | Class source |
ExampleTest.php | Class | Class source |
PasswordConfirmationTest.php | Class | Class source |
PasswordResetTest.php | Class | Class source |
ProfileInformationTest.php | Class | Class source |
RegistrationTest.php | Class | Class source |
TwoFactorAuthenticationSettingsTest.php | Class | Class source |
UpdatePasswordTest.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.