PHPackages                             kerwin/simpleframe - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. kerwin/simpleframe

ActiveProject[Framework](/categories/framework)

kerwin/simpleframe
==================

simple framework with auth

2.2(4y ago)05Twig

Since May 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jhuei0831/simpleframe)[ Packagist](https://packagist.org/packages/kerwin/simpleframe)[ RSS](/packages/kerwin-simpleframe/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (8)Dependencies (15)Versions (12)Used By (0)

目錄
==

[](#目錄)

1. [系統資訊](#%E7%B3%BB%E7%B5%B1%E8%B3%87%E8%A8%8A)
2. [Database](#database)
    1. [介紹](#%E4%BB%8B%E7%B4%B9)
    2. [指令](#%E6%8C%87%E4%BB%A4)
3. [Container](#container)
4. [Controller](#controller)
5. [Model](#model)
    1. [介紹](#model_intro)
    2. [設定主鍵](#model_key)
    3. [將Models加入Container](#model_container)
    4. [功能](#model_fun)
6. [View](#view)
    1. [介紹](#view_intro)
    2. [LayoutExtension](#view_ex)
    3. [應用](#view_app)
7. [Route](#route)
    1. [介紹](#route_intro)
    2. [應用](#route_app)
8. [Middleware](#middleware)
    1. [介紹](#middleware_intro)
    2. [應用](#middleware_app)
9. [Log](#log)
    1. [介紹](#log_intro)
    2. [應用](#log_app)

系統資訊
====

[](#系統資訊)

[🔼](#)

- 開發環境

  PHP 7.4.13   MariaDB 10.4.17   Apache 2.4.46 ---

### 1. 安裝框架

[](#1-安裝框架)

```
composer create-project kerwin/simpleframe simpleframe --repository="{\"type\": \"vcs\",\"url\": \"https://github.com/jhuei0831/simpleframe.git\"}"

```

- 編輯設定檔 `.env`

### 2. 安裝npm套件

[](#2-安裝npm套件)

```
npm install

```

### 3. 建立tailwind css

[](#3-建立tailwind-css)

開發時使用:

```
npm run build:tailwind-dev

```

開發完成後使用:

```
npm run build:tailwind-prod

```

- tailwind css相關設定到 `tailwind.config.js`設定
- 設定tailwind css 檔案輸出路徑請到 `package.json` 的 `scripts` 設定

### 4. 設定webpack

[](#4-設定webpack)

開發時使用:

```
npm run watch

```

開發完成後使用:

```
npm run serve

```

- webpack 相關設定請到 `webpack.config.js` 設定

### 5. setting.php

[](#5-settingphp)

- config/setting.php 中可以設定允許看見錯誤訊息的ip清單

### 6. .htaccess

[](#6-htaccess)

- RewriteBase 你的路徑

### 7. 建立資料庫及資料

[](#7-建立資料庫及資料)

```
vendor\bin\phinx migrate
vendor\bin\phinx seed:run

```

### 8. 降php版本

[](#8-降php版本)

- 在composer.json中加入，以降至7.2版本為例

```
"config": {
    "platform": {
        "php": "7.2.0"
    }
}

```

- 刪除`composer.lock`及`/vender`後執行`composer update`

---

Database
========

[](#database)

[🔼](#)

介紹
--------------------------------------

[](#介紹)

使用[robmorgan/phinx](https://book.cakephp.org/phinx/0/en/index.html)，透過指令的方式將資料表建立或加入測試資料。

資料表schema放在`/database/migrations`底下，資料建立放在`/database/seeds`底下。

> 如果要更改放置位子可以到`/phinx.php`中修改

phinx.php

```
