# Quick Setup

The directory structure for a project using sirJuni Framework should be as shown below (it is not necessary to have same project structure but this tutorial will assume the structure below):

```
- ProjectName/
    - App/
        - config.php
        - routes.php
        - model.php
        - controllers.php
    - static/
        - css/
        - js/
        - images/
    - templates/
        - index.html
    - index.php
    - .htaccess
    - composer.json
```

After creating a directory with above structure, copy the below contents into `composer.json`

```json
{
    "autoload": {
        "psr-4": {
            "sirJuni\\Framework\\" : "vendor/shoaib/sir-juni/src/"
        }
    },

    "require": {
        "shoaib/sir-juni" : "dev-master"
    }

}
```

Make sure you have composer installed by running the following command in your terminal

```sh
$ composer --version
```

If its not installed, then go the official website <https://getcomposer.org/download/> and install it from there.

After adding above contents to composer.json run, enter the root directory of the project (here : `ProjectName/`) and run `$ composer install`.

It would download the framework and create a directory by the name `vendor` which contains the `autoload.php`. Every file that uses components from this framework should include this `autoload.php` file at the top, which then allows auto loading of classes to work.

## Enable URL rewriting

Since this framework is MVC based, we have a single file that gets all the requests to handle. This file then sends the request to different components of the Framework ending with rendering of a page.

To enable url rewriting, create a file in the root directory of the project (ProjectName/) by the name `.htaccess`. This file describes config on per folder basis. So, putting it in the root folder, describes its config.

Paste the following contents in this file

```
RewriteEngine on

RewriteCond %{REQUEST_URI} !\.(css|js|jpg|jpeg|png|gif)$

RewriteRule ^(.+)$ index.php [L]
```

What above file does is, if we try to visit any url that does not end with a file extension listed above, it rewrites that url and sends the request to the `index.php` file which is our entry point into the framework.

The above file extensions are blacklisted because we want to be able to embed images and css, js files in our html pages.

If you want to understand what each line does, just use ChatGPT for that.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://shoaib-1.gitbook.io/sirjuni/quick-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
