aldearco/arco-framework

受Laravel启发的简单PHP框架

v0.2.0 2023-02-08 19:13 UTC

This package is auto-updated.

Last update: 2024-09-09 13:43:06 UTC


README

Arco Framework Icon

Arco 框架

Total Downloads Latest Stable Version License

此框架受 Laravel 启发,绝对不打算与 Laravel 竞争。

Arco 框架是在以下课程的教育目标下创建的

用PHP创建自己的Web框架

警告

此框架不适合生产环境,可能存在多个错误。目前,其开发仅用于教育目的。

创建项目

Composer

composer create-project aldearco/arco

下载源代码

最新版本

解压并运行 composer install

部署

根目录

如果您在根目录中执行部署,您不需要将任何其他文件添加到项目中,但您需要在该文件中指定服务器默认公共文件夹的名称。默认情况下,公共文件夹是 /public,但如果您需要将其更改为 /public_html,您可以在 ./config/app.php 文件中的“public”键中这样做。

共享主机

如果您在公共或public_html文件夹中的共享主机上部署项目,您可能需要创建某些文件,具体取决于您的服务器系统。您可能需要修改或添加一些建议的代码行。

Apache

.htaccess

<IfModule mod_rewrite.c>
RewriteEngine on

# Serve existing files in the /public folder as if they were in the root of the site.
RewriteCond %{DOCUMENT_ROOT}public%{REQUEST_URI} -f
RewriteRule (.+) /public/$1 [L]

# Route requests for /storage/ to the /storage/ directory using the P(passthrough) flag.
RewriteRule ^storage/(.+) /storage/$1 [PT]

# Route everything else to /public/index.php
RewriteRule ^ /public/index.php [L]
</IfModule>

#Disable index view
options -Indexes

<Files .env>
order allow,deny
Deny from all
</Files>

Nginx

mysite.conf

server {
listen 80;
server_name example.com;
root /var/www/example.com;

location / {
    try_files $uri $uri/ /public/index.php;
}

location /public {
    try_files $uri $uri/ /public/index.php;
}

location /storage {
    internal;
}

location ~ \.env$ {
    deny all;
}

location ~ ^/storage/ {
    internal;
}