How to use laravel package in lumen? - laravel

I want to use a laravel package named thinksaydo/envtenant from githup link
This package for creating multitenancy software in laravel , but i can't install this package in lumen
How can install this package and use it in lumen?

There are so many things you'll need for Tenancy that Lumen doesn't provide out of the box. You'll need to enable Facades, setup your Providers, and Lumen doesn't provide session support out of the box.
The purpose of Lumen is to provide a simple, fluid, stateless API that returns a Data Interchange Language. What you're doing here is attempting to run a fully-functional SaaS service on a Micro-API framework; that's not going to work.
You need to be using Laravel to accomplish the SaaS model, so it can know about Tenancy.
In Lumen, the only thing you should be looking at is an API key in your request.

Related

Front end of application is built in Laravel livewire and want to consume API's built in Lumen

I was handed over a project by my company, it was made in Laravel with livewire and Nova.The company wants me to redo the app by consuming API's written in Lumen.
The first thing that I want to ask is whether its a good idea and secondly how to go about storing jwt token in Laravel provided by the Lumen login API and use it in subsequent requests?
First question you need to ask is why do they want to rebuild something existing under Laravel to Lumen. Lumen is basically a lightweight version of Laravel. If the idea is to seperate the frontends from the backend you could keep using Laravel, it can definitely be used to define APIs.
Regarding your second question, there are already some existing libraries (https://github.com/dusterio/lumen-passport ) which can help you use Laravel Passport in Lumen, so you shouldn't have any issue and you should be able to use your token everywhere.

Restful api versioning in Laravel 8

I am trying to build a restful api using Laravel-8. Already I have setup Laravel-Passport for api authentication. Now I want to do API versioning for the Laravel-8.
I've heard about Dingo being used with jwt-auth. But I am using laravel passport.
Which api versioning package can I use for the restful api with Laravel Passport auth?
Thanks.
You don't need a package for it. You just need to set-up your Laravel project correctly.
Take a look at:
https://medium.com/mestredev/versioning-your-rest-api-with-laravel-646bcc1f70a4

How can i create multiple authendication in laravel api?

I have two different registers and logins. How can i create multiple authendication for that using laravel api.
It's a little bit tricky because Laravel Passport doesn't currently support multiple authentication yet. What I did with a previous project of mine is use this package for implementing multiple authentication for APIs using Laravel Passport. The package I've suggested is fairly simple to implement. Go check it out!

Information on laravel API

I need clear information about laravel API.
I've been reading lots of articles about laravel API. Beside choosing between JWT and laravel-passport—which is a whole different level of confusion—I need to get basic information about laravel API to make it clearer to me what's what.
Questions
Why does laravel passport need a database (what's the usage of those tables)?
If I change auth driver to passport in authProvider file, and not use api, would it affect my normal auth behavior?
If i use API (passport) do I have to use laravel-echo or any js library?
Laravel passport needs database to store tokens that are generated and used during authorization. Also, needs to bind these tokens to a specific users.
There are actually 5 new tables that are generated from migrations when installing Laravel Passport:
https://github.com/laravel/passport/tree/7.0/database/migrations
About using Laravel Echo or any js library is optional, and Laravel Passport does not require any of these.
See the Laravel Passport composer.json on requirements and other dependencies:
https://github.com/laravel/passport/blob/7.0/composer.json

Laravel Bundle OneAuth compatibility with Sentry

My team and I(the business/idea guy) are developing a new Startup using the Laravel framework. I'm not a tech guy but I want to learn as much as possible.
We began with installing and utilizing the Sentry Bundle, and then added the OneAuth bundle for the Facebook login; however, we continued to get errors.
Is OneAuth not compatible with Sentry?
Sentry is coming out with a socialplugin soon. Should we just wait for that or how should we go about this?
OneAuth author here, the problem right now is Sentry is not using Laravel Auth Driver to authenticate the user which make it difficult for the integration to happen. The two way to tackle the limitation:
Convert all Auth called in OneAuth to use Laravel\IoC, this would require Sentry to register IoC on their side.
Sentry to add an adapter class (extends Laravel\Auth\Drivers\Driver)
Either ways, there some works need to be done on Sentry side, I'm open for solution if they are looking to use OneAuth as their social plugin.

Resources