LaravelPackages.net
Acme Inc.
Toggle sidebar
suhasrkms/lara-fire

Laravel 13 + Firebase starter kit: Firebase Auth (email, Google, GitHub), admin panel with custom claims, Cloud Firestore CRUD, FCM push notifications and a Firebase ID-token REST API.

269
9
v2.0.0
About suhasrkms/lara-fire

suhasrkms/lara-fire is a Laravel package for laravel 13 + firebase starter kit: firebase auth (email, google, github), admin panel with custom claims, cloud firestore crud, fcm push notifications and a firebase id-token rest api.. It currently has 9 GitHub stars and 269 downloads on Packagist (latest version v2.0.0). Install it with composer require suhasrkms/lara-fire. Discover more Laravel packages by suhasrkms or browse all Laravel packages to compare alternatives.

Last updated

Laravel 13 Firebase PHP 8.3+

🔥 Lara Fire

Latest Stable Version Total Downloads tests License: MIT Docs

📖 Documentation · Installation · Firebase setup · REST API · Troubleshooting · ▶ Videos

A Laravel 13 + Firebase starter kit. Firebase Authentication, an admin panel driven by custom claims, Cloud Firestore CRUD, push notifications and a REST API that accepts Firebase ID tokens. No SQL database is needed.

| | Feature | |---|---| | 🔐 | Email/password, Google and GitHub sign-in, email verification, password reset | | 🛡️ | Admin panel: search, stats, grant/revoke admin, enable/disable users, send reset links | | 🗂️ | Cloud Firestore Notes module: per-user CRUD over REST, with no gRPC needed | | 🔔 | FCM push: users opt in per browser, and admins broadcast or target one user | | 🔌 | REST API /api/v1 authenticated with Authorization: Bearer <Firebase ID token> | | 🌙 | Bootstrap 5.3 UI with dark mode, built with Vite 8 |

Lara Fire admin panel

Login Dashboard Firestore notes

📖 Documentation

The full docs are at suhasrkms.github.io/lara-fire-docs.html.

| Getting started | Features | Guides | |---|---|---| | Requirements | Authentication | How it works | | Installation | Google & GitHub login | Customizing | | Firebase setup | Admin panel & roles | Testing | | Configuration (.env) | Cloud Firestore | Deployment | | Running the app | Push notifications | Troubleshooting | | Upgrading from v1 | REST API | FAQ |

Quick start

composer create-project suhasrkms/lara-fire my-app
cd my-app
npm install && npm run build
  1. Service account: open Firebase console → Project settings → Service accounts → Generate new private key. Save the file as storage/app/firebase/service-account.json. It is git-ignored.
  2. Web config: under Project settings → General → Your apps → Web, copy the values into the FIREBASE_WEB_* keys in .env.
  3. Sign-in methods: under Authentication → Sign-in method, enable Email/Password plus Google and/or GitHub. Add your domain under Authorized domains.
  4. Run it:
php artisan serve          # or: composer dev  (server + logs + vite)
php artisan larafire:about # checks your setup
  1. Register an account, then give yourself admin rights from the terminal:
php artisan larafire:make-admin [email protected]

Optional features

Push notifications (FCM)

Generate a key pair under Project settings → Cloud Messaging → Web Push certificates and set FIREBASE_WEB_VAPID_KEY. Users click Enable on this device on the dashboard. Admins send messages from Admin → Push notifications. The app uses topics (larafire-all, larafire-user-<uid>), so tokens don't need to be stored.

Cloud Firestore

Notes use Firestore's REST API with your service account. You don't need the grpc extension or any extra package, and it works on Windows as-is. Create the database in Firebase console → Firestore Database → Create database. Notes are stored in notes/{id} as { uid, title, body, created_at, updated_at }. Suggested security rules if you also read Firestore from clients:

match /notes/{id} {
  allow read, write: if request.auth != null && request.auth.uid == resource.data.uid;
}

REST API

Get an ID token on the client (await auth.currentUser.getIdToken()) and send it as a bearer token:

curl http://localhost:8000/api/v1/me -H "Authorization: Bearer $ID_TOKEN"

| Method | Endpoint | Auth | |---|---|---| | GET | /api/v1/me | ID token | | GET / POST | /api/v1/notes | ID token | | GET / PUT / DELETE | /api/v1/notes/{id} | ID token |

Commands

| Command | What it does | |---|---| | larafire:make-admin {email} [--revoke] | Grant or revoke the admin custom claim | | larafire:about | Show setup status and next steps |

Upgrading from v1

v2 is a rewrite on Laravel 13. Your Firebase users and claims carry over unchanged.

  • Move your key to storage/app/firebase/service-account.json and update FIREBASE_CREDENTIALS.
  • The /home/iamadmin route has been removed because any user could promote themselves. Use php artisan larafire:make-admin.
  • See CHANGELOG.md for everything else.

Testing

composer test   # Firebase is mocked, so no credentials are needed

📺 Video tutorials

Walkthroughs for this project are on Seven Stac.

Contributing

Issues and PRs are welcome. Please run composer lint and composer test before opening a PR.

License

MIT © Suhas R


Made with ❤️ by suhasrkms

Comments