Fast Version

First Set of Commands:

git clone https://github.com/codewithtonyofficial/laravel-medialibrary.git laravel-medialibraryV2
cd laravel-medialibraryV2
composer install
code .
cp .env.example .env; code .env

Create database and update env file:

APP_URL=http://localhost:8000
DB_DATABASE=[DATABASE NAME]
DB_USERNAME=root
DB_PASSWORD=

Second Set of Commands:

php artisan storage:link
php artisan migrate
php artisan key:generate
php artisan serve

Detailed Version

Follow these steps to have a complete Laravel Application with Spatie Media Library fully functional open source website.

  1. $ git clone https://github.com/codewithtonyofficial/laravel-medialibrary.git laravel-medialibraryV2
  2. $ cd laravel-medialibraryV2
  3. $ composer install
  4. $ code .
  5. $ cp .env.example .env; code .env
  6. Create a database to connect. for example, mysql with phpmyadmin
  7. update the following env file:
    APP_URL=http://localhost:8000
    DB_DATABASE=[DATABASE NAME]
    DB_USERNAME=root
    DB_PASSWORD=
  8. $ php artisan storage:link
  9. $ php artisan migrate
  10. $ php artisan key:generate
  11. $ php artisan serve
  12. open browser to http://127.0.0.1:8000/posts/create
  13. Done

Resources:

  • https://stackoverflow.com/questions/50395449/laravel-image-saved-in-storage-folder-not-showing-to-user
  • https://laravel.com/docs/9.x/filesystem#the-public-disk
  • https://laracasts.com/discuss/channels/laravel/spatie-media-library-issue-with-geturl-method?reply=730889
  • https://stackoverflow.com/questions/55474258/how-to-install-enable-gd-in-xampp-windows-php-7-2