Does Laravel Forge provide Domain Park API? - php

I am creating Multi-tenant website using Laravel.
Does Laravel forge provide domain mapping API?
I would like to let users use their own domain instead of our subdomain.
For example: user will get subdomain in our website.
https://username.mywebsite.com
And if he has his domain userdomain.com, he will be able to change CNAME in domain registrar so that he can use his own domain instead of our website subdomain.
And also on my side, I will need to park that domain on the my project domain.
https://username.mywebsite.com // subdomain of our website.
https://userdomain.com // user's own domain
For now, I am using Cpanel API to park user's domain on our website.
I am quite new on laravel forge and if there is the way to park domain using laravel forge API, it will be great.
Any suggestion would be highly appreciated.

This is not possible directly from the Forge UI.
However, you could comfortably create a new alias for each new client via the API, specifically the update site endpoint: https://forge.laravel.com/api-documentation#update-site
Just be mindful you will need to pass the full list of aliases each time, including your mywebsite.com domain. This can easily be done by fetching the site first.

Related

Laravel - A SaaS that allows a user to use his own domain to redirect to SaaS subdomain

I have a SaaS application built using Laravel, the user registers and gets a subdomain (e.g. myapp.domain.com), but during the registration process the user might choose to use his own domain instead of this subdomain, so there's a field that allows him to enter the desired domain (e.g. anotherdomain.com)
Normally, I do this manually by adding an entry to the virtual hosts. However i wonder if there's anyway to achieve this in Laravel
Has anyone tried this before ?

Custom Domain mapping in cloud based application

I am creating a cloud based application in laravel/php.
I have a functionality where user can have their website at user.myapp.com and it works (with subdomain and model binding).
I now want to go one step further, and allow users to add their own custom domain names. So their website will be reachable at user-domain.com rather than (or as well as) user.myapp.com.
I want to understand how to do this. I'm using Laravel framework which is based on php and apache.
What kind of server do I need? Can I use shared hosting?
What configs do I need to do in order for this to work?
What DNS record the user must create to put things together?
You can do this with any kind of server. You can make a route that is caught by any domain and in the controller of this route, you can query the database to know what website should be displayed for that domain.
You can get the domain name of the current request using app('request')->root();

Point Sub Domain to another Domain

We are creating a SAAS base application, where every company get its own subdomain. But if the company wants to configure another domain with our application, they can do that.
e.g. I am a company registered with the application www.mysaas.com, i got the subdomain "company.mysaas.com", now i want to point my "company.com" domain to the "company.mysaas.com", so how we can achieve this?
We want to create a custom domain configuration settings for the users of our application. Its like wordpress domain mapping (you can point your own domain to the wordpress site). So as i read related with wordpress they asked to add the CNAME of your site for the domain which you want to configure for mapping.
Our application is written in Codeigniter.
Is there any server configuration changes we need to do to achieve this?

Building a SaaS application in CodeIgniter like Shopify with custom domain alias

I am working on a SaaS application. We take Shopify / Magento Go etc as reference.
I used CodeIgniter PHP framework.
SaaS Methodology - Multiple database, single code-base
Our SaaS architecture is as follows:
when a customer signup a database is build with his name and contain his specific databases.
when a customer signup he get a sub-domain (Ex: test1.example.com)
The customer can add his own domain that points to the system defined sub-domain. (Ex: test1.example.com to www.mydomain.com )
How to achieve this functionality?
For this you have to go through few configuration options.
Configure DNS: Create sub-domain with *. (ask you host)
You have to configure apache or .htaccess to point all requests coming to your domain point to same directory.
Database Setting: Try to learn how to use multiple database in codeigniter.
That's all. Enjoy!
I think that you should look for the term: " codeigniter multi Tennant app " and as said before, managing too many database isn't a solution!
You can achive proposed SAAS application this way,
There will be 1 database for application itself, and another N number of databases for clients, each new client will have new database.
Allow signup to your clients by asking basic details + subdomain to choose like blogspot do, subdomains taken by existing clients wont be allowed to reuse
When client signup successfully, one separate DB will be created and they will landed to their dashboard. Here one DB server will be fine but should have enough space and other parameter set to handle multiple databases.
Now dahsboard onwards, user will able to see list of functionality to use along with some predefined set of content that will be shared between user and loaded from "app DB". Whatever they do add will goes to their own independent DB
Here codebase will be deployed at one code server and main domain will be mapped to that so login/singup etc will be happen here and user's identification will happen at login level.
App DB: This DB will be responsible to store app level master data, i.e. Client's profile + login details, other admin related stuff which they meant to share to their clients. In case of shopify kind of app, themes, layout, templates can be master stuff that will store into this DB.
User DB: Only user's created, added content and its sub content should be stored. Whatever we can call user's ownership should be stored here.
Note: If its paid service, then you can use good payment gateway like stripe or chargebee to manage all your plans, subscriptions, email notification, dunning, payments log, payment success/failure, payment invoices.
WRT to subdomain and custom domain concept, you can do this using virtual hosting mechanism, you can do with apache as well as nginx server.
- Subdomain: Create config files as per server, put on proper place and any created subdomain will bind to particular pysical virtual directory
- Customdomain: Can create physical directory same as subdomain along with config files but in this case, you will need to ask your client to do DNS binding with our IP addess
In both this case when request comes to our server, server will check if config file and physical directory available tp hit then it will redirect user to destiny forlder.

Getting website content from different location

I am developing an online accounting project. I do not want to give my code to the clients, but I have to give control of the domain to them. How can I configure the application such that it uses the Database from my client's domain and the application from my own domain ?
For eg : my application domain in www.a.com and my clients domain are b.com, c.com and so on.
a.com holds the application source code and b.com holds the database.
Now what I want to do is get the application code from a.com and get database from b.com whenever b.com is opened.
Or is there any other way to achieve it ?
Look into setting a CNAME record through your domain name's administration settings and using sub-domains, perhaps.
Here's more information from Google http://support.google.com/a/bin/answer.py?hl=en&answer=47283 and Wikipedia http://en.wikipedia.org/wiki/CNAME_record

Categories