# เริ่มต้นใช้งาน

สำหรับ Q Lipe เป็น PHP Framework ที่พัฒนาขึ้นมาโดยคำนึงถึงความยืดหยุ่นเป็นหลัก โดยที่ระบบถูกจัดวางในรูปแบบเว็บไซต์ทั่วๆไป แต่เราสามารถพัฒนาต่อยอดให้เป็น MVC หรืออื่นๆ โดยเพียงเพิ่มโค๊ดเพียงไม่กี่บรรทัดเท่านั้น

### &#x20;ความต้องการของระบบ

1. PHP เวอร์ชั่น 7.0.1 หรือมากกว่า
2. เปิดใช้งาน mod\_rewrite
3. เปิดใช้งาน PDO<br>

### ติดตั้ง

การติดตั้งจะทำได้โดยการดาวน์โหลดผ่าน Github เท่านั้น เมื่อดาวน์โหลดเสร็จสิ้น ให้ทำการแยกไฟล์และนำไฟล์ของ Q Lipe ไปไว้โฟลเดอร์ที่ท่านจะทำงาน [ดาวน์โหลด](https://github.com/Framyomyim/q-lipe)

**ดาวน์โหลดผ่าน Git**

`git clone https://github.com/Framyomyim/q-lipe.git`

### &#x20;ค่าเริ่มต้น

ให้ท่านไปยังโฟลเดอร์ที่ท่านติดตั้งไว้ และหา `Application/Public/Home.php`

```
<?php 

    defined( 'Q_APP' ) or die( 'คุณไม่มีสิทธิ์เข้าถึงไฟล์นี้โดยตรง' );

    // ค่าเริ่มต้นสำหรับโปรแกรม

    $app = new App;
    $app::render( function() use ( $app ) {
        $app->load->php( 'welcome' );
    } );

?>
```

โค๊ดที่ท่านเห็นอยู่ คือค่าเริ่มต้นที่ถูกกำหนดมา หลักการก็คือเราสร้าง **Object** ที่ชื่อว่า "**App**" ขึ้นมาโดยเก็บไว้ในตัวแปร `$app` และเรียกใช้เมธอด (แบบ Static) `render` ในเมธอด `render` เราจะทำการใช้งาน *Callback Function* ทั้งนี้เราจำเป็นที่ต้องใช้ `use ( $app )` เพราะจะทำให้เราสามารถเรียก `Instance` ของ Current Object (Object ที่ใช้งานอยู่) ได้

หรือถ้าหากใครไม่ถนัดในการใช้ *Callback Function* ท่านก็สามารถเขียนในรูปแบบอิสระของท่านตามสะดวกได้ อาทิเช่น Class เป็นต้น แต่ทั้งนี้ทั้งนั้นทางเรามีข้อแนะนำว่า ถ้าท่านต้องการเขียน **Class** ไว้ใช้งานให้ท่านทำการเขียนในโฟลเดอร์ `Application/Public/Core/` , เช่นเดียวกันกับ **Function** ให้ท่านสร้างไฟล์ที่โฟลเดอร์ `Application/Public/Helper/`


---

# 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://kittichai-malain.gitbook.io/q-lipe/master.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.
