Manage created projects gracefully!

  • | 7046 points

    As seen in my post How to disable auto virtual hosts?, we discussed that Auto virtual hosts, Auto Database and Auto SSL certificates create the unwanted (v-host, SSL) files and databases. Keeping these settings off makes Laragon just a tool to select desired PHP, Apache, MySQL versions. The proposed feature can give us an ability to choose what we want to have at the time of creating a project. This again will fall short in case of creating sub-domains.

    Laragon gives us an ability to adds a v-host entry in hosts file automatically and manually if wanted using the h button:


    Just like this, there should be a way to effectively create and manage our projects.


    Thus I propose something like following which will help us create and manage our projects gracefully.

    ; virtual host with ssl disabled
    []                   ; if the project with the given name at the given path already does exists, do not create project and v-host.
    project=                        ; if the project is not provided or if its value is "" or "blank", create a blank project
                                    ; values: "", "blank", any Quick create project entry
    path=/website                   ; relative path to project folder inside root www folder
    www=0                           ; if www is not provided or if its value is 0, do not create www subdomain
                                    ; values: 0 or 1
    ssl=0                           ; if ssl is not provided or if its value is 0, do not create ssl certificates
                                    ; values: 0 or 1
    database=0                      ; if database is not provided or if its value is 0, do not create database
                                    ; values: 0, 1 or desired database name
                                    ; if the value is 1, create database with the name of the project root folder else with the provided name
                                    ; if the database with the name already does exist, do not create database
    git=0                           ; do not initialize git repo
    ; virtual host with ssl enabled
    []                  ; =>
    www=1                           ; =>
    project=Laravel                 ; create a new Laravel project
    path=/domain                    ; set project root folder
    ssl=1                           ; create SSL certs
    database=mydomaindb             ; desired database name
    git=1                           ; initialize new git repo
    ; sub-domain
    []            ; =>             ; create a subdomain from the settings of a main-domain
                                    ; use settings (ssl, path, database) as specified for main-domain
                                    ; path here will be unnecessary as the path will be generated relative to the main-domain (project root)
                                    ; path will be:         /{ProjectRootFolder}/{SubdomainName}
                                    ; thus absolute folder path will be: /domain/mysub
                                    ; if domain is not specified, then use the provided settings
    ; sub-domain 2
    []           ; =>
                                    ; useful if want to create a subdomain with custom settings like custom path, project (blank/Laravel/Symfony) etc.
    path=/domain/anothersub         ; sub-domain points to desired folder inside (or outside) of the project root folder

    Each new section will contain the name of the virtual host to create.
    The keys and values will define how the project will be formed.

    The following keys can be used:

    project: This is what project we want to create. This will emulate the Quick create prompt from Laragon GUI.
    If this key is not provided, a blank project will be created.
    This key is not required if the domain key is used.

    path: By default, Laragon creates the new project in the root www directory. This option will give us the freedom to choose where we want to store our project and what will be the directory name.
    In above example, the first section name is, Omitting the last .dev part (the part after last . (dot) in the section name) we get website. This will be the default name for the directory if the path is not specified.
    This key is not required if the domain key is used.

    www: This may seem trivial but, it will help us set up the www subdirectory if we want.
    This will point to the main domain.
    0 : Do not create www sub-domain,
    1: Create www sub-domain
    This key is not required if the domain key is used.

    ssl: Set this if we want SSL certificates created for the specified project.
    0: Do not create SSL certificates,
    1: Create SSL certificates
    This key is not required if the domain key is used.

    database: This will help us choose if we want the database created or not.
    0: Do not create the database,
    1: Create the database with the name of the project,
    {databaseName}: Provide desired database name
    This key is not required if the domain key is used.
    This will not create the database if the same database already exists.

    git: This will initialize a git repo.
    0: Do not initialize a git repo,
    1: Initialize a git repo for the current project,

    domain: This is the only key which if used, does not require any other keys to be passed.
    This key must have a predefined section name as a value to relate to. i.e. existing virtual hostname. (Look at the in above example, where is already existing section name)
    Use this if we want to create a sub-domain and want it to possess all the characteristics of its main-domain (except the www and project keys).
    This will create the sub-domain directory (mysub in above example, which is obtained by omitting the domain value from the sub-domain section name) inside the main-domain directory (i.e. /domain).
    The project created will be blank irrespective of the main-domain project.

    As the last example, we can define this sub-domain as per our requirements irrespective of the main domain settings. Such approach can be used to create fine-grained sub-domain.

    Creating projects with quick create prompt will append the project details to this file.

    If we do want to make a complex project with intricate directory structure/sub-domains, and not to use quick create prompt, we can define our requirements (e.g. like the example above). Reloading Apache/Nginx will create directories, v-hosts, ssl certs, databases, sub-domains etc.

    This will only create the newly defined projects, not the existing projects.

  • administrators
    | 131219 points

    @bantya : Many thanks for the information - very detailed!. I'll think about it :)

  • | 7046 points


  • | 390 points

    Yes, it would be nice to have more granular control over your projects, such as defining a DocumentRoot.

    Some of my projects are Laravel, and I have to point it to {project}/public folder, for example.

  • administrators
    | 131219 points

    @Lucas-Bustamante : Laragon auto detects public folder to set DocumentRoot. I don't know why you have to do that?

  • | 7046 points

    Updated to include the git initialize feature (based on

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.