vaibhavpandeyvpz / laravel-crud
The skeleton application for the Laravel framework.
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.2
- http-interop/http-factory-guzzle: ^1.2
- intervention/image: ^2.7
- jamesmills/laravel-timezone: ^1.13
- laracasts/flash: ^3.2
- laravel/framework: ^10.10
- laravel/horizon: ^5.19
- laravel/prompts: ^0.1.5
- laravel/sanctum: ^3.2
- laravel/scout: ^10.2
- laravel/socialite: ^5.8
- laravel/tinker: ^2.8
- laravel/ui: ^4.2
- league/flysystem-aws-s3-v3: ^3.0
- livewire/livewire: ^2.12
- meilisearch/meilisearch-php: ^1.3
- quarks/laravel-auditors: ^1.2
- quarks/laravel-locking: ^1.0
- spatie/laravel-activitylog: ^4.7
- spatie/laravel-permission: ^5.10
- tightenco/ziggy: ^1.6
Requires (Dev)
- fakerphp/faker: ^1.9.1
- laravel/pint: ^1.0
- laravel/sail: ^1.18
- laravel/telescope: ^4.16
- mockery/mockery: ^1.4.4
- nunomaduro/collision: ^7.0
- phpunit/phpunit: ^10.1
- spatie/laravel-ignition: ^2.0
This package is auto-updated.
Last update: 2024-07-03 10:59:01 UTC
README
vaibhavpandeyvpz/starter-laravel
Quick, Laravel CRUD boilerplate using Livewire with RBAC. Uses Docker for local development & production deployments, has better auth views based on Bootstrap, nicely integrates Select2 and Flatpickr as well.
Prepare
If you wish to use SSL for local development (recommended), you need to have mkcert installed on your machine. Once installed, next install the mkcert's local CA in system's trust store.
$ sudo mkcert -install
Then generate an SSL certificate for local development using below command:
$ mkcert local.dev '*.local.dev' localhost 127.0.0.1 ::1
Installation
Before installing, make sure to have Docker installed on your workstation. Then simply download or clone the code and run below commands in project folder:
# create from example file(s) $ cp .env.example .env $ cp ngrok.example.yml ngrok.yml # setup NGROK_AUTHTOKEN in .env # start the services $ docker compose up -d # spawn a shell in web container $ docker compose exec web bash # install dependencies $ composer install && yarn install && yarn build # set application key $ php artisan key:generate # initialize scout indices $ php artisan scout:sync-index-settings # prepare database $ php artisan migrate --seed # link public storage directory $ php artisan storage:link
You can access the project via browser at https://web.local.dev/ or http://localhost:8000/.
To be able to manage users, roles etc., you must create or assign relevant roles to a user. You can do so by running below command and providing the user information interactively:
$ php artisan make:admin
Extras
Traefik requires you to route hostnames to your local machine.
To do so, add the following lines to your /etc/hosts
file:
127.0.0.1 cdn.local.dev
127.0.0.1 mailcatcher.local.dev
127.0.0.1 meilisearch.local.dev
127.0.0.1 minio.local.dev
127.0.0.1 phpmyadmin.local.dev
127.0.0.1 redis-commander.local.dev
127.0.0.1 web.local.dev
The Docker setup also include below services to ease local development:
- MailCatcher - to catch all outgoing emails, access on https://mailcatcher.local.dev/
- Meilisearch - a full-text search engine, access on https://meilisearch.local.dev/
- MinIO - an S3 compatible storage, access on https://minio.local.dev/
- phpMyAdmin - to manage SQL database, access on https://phpmyadmin.local.dev/
- Redis Commander - to manage Redis data, access on https://redis-commander.local.dev/
Some additional configuration described below may be needed for extended functionality.
File uploads
Before uploading files, you may need to log in to MinIO console at https://minio.local.dev/ using laravelapp
as both (username and password) and create a bucket named laravelapp
.
Once created, go to bucket's settings and change its Access Policy to Public
.
Ngrok
The project setup also includes ngrok service. To get the active tunnel URL, use below command:
# start the services $ docker compose up -d # show ngrok tunnel url $ php artisan ngrok:discover
Code-style
The project uses laravel/pint to enforce code-style. To run it and fix any issues, use below command:
$ docker run --rm -v .:/workspace syncloudsoftech/pinter
Deployment
You can deploy the project into production (using Docker) using below commands:
# build production container $ docker build -t laravelapp . # push image to registry $ docker push laravelapp