dotkernel / frontend
DotKernel 前端应用程序
Requires
- php: ~8.2.0 || ~8.3.0
- ext-curl: *
- ext-gettext: *
- ext-json: *
- dotkernel/dot-authorization: ^3.4.1
- dotkernel/dot-controller: ^3.4.3
- dotkernel/dot-data-fixtures: ^1.1.3
- dotkernel/dot-dependency-injection: ^1.0.0
- dotkernel/dot-errorhandler: ^4.0.0
- dotkernel/dot-flashmessenger: ^3.4.2
- dotkernel/dot-mail: ~3.4 || ^4.1.1
- dotkernel/dot-navigation: ^3.4.2
- dotkernel/dot-rbac-guard: ^3.4.3
- dotkernel/dot-response-header: ^3.2.3
- dotkernel/dot-session: ^5.6.0
- dotkernel/dot-twigrenderer: ^3.4.3
- friendsofphp/proxy-manager-lts: ^1.0.16
- laminas/laminas-component-installer: ^3.4.0
- laminas/laminas-config-aggregator: ^1.14.0
- laminas/laminas-form: ^3.19.1
- laminas/laminas-i18n: ^2.26.0
- mezzio/mezzio: ^3.18.0
- mezzio/mezzio-authorization-rbac: ^1.7.0
- mezzio/mezzio-cors: ^1.11.1
- mezzio/mezzio-fastroute: ^3.11.0
- ramsey/uuid-doctrine: ^2.1.0
- roave/psr-container-doctrine: ^5.2.2
Requires (Dev)
- filp/whoops: ^2.15.4
- laminas/laminas-coding-standard: ^2.5
- laminas/laminas-development-mode: ^3.12.0
- mezzio/mezzio-tooling: ^2.9.0
- phpunit/phpunit: ^10.5
- rector/rector: ^1.0.0
- roave/security-advisories: dev-master
- vimeo/psalm: ^5.21.1
- vincentlanglet/twig-cs-fixer: ^2.12
- 5.0.x-dev
- 5.0.0
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.x-dev
- 4.0.0
- 3.3
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.x-dev
- 3.0.1
- 3.0.0
- 2.0.x-dev
- v2.0.0
- 1.0.x-dev
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- 0.5.0
- 0.4.1
- 0.4.0
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.2
- 0.1.1
- 0.1.0
- dev-issue-487
- dev-arhimede-patch-1
- dev-issue-342
- dev-issue-365
- dev-rector-rules-combined
This package is auto-updated.
Last update: 2024-09-25 13:04:47 UTC
README
DotKernel 适合前端应用程序的 Web 入门包。
安装 DotKernel frontend
工具
DotKernel 前端界面已与 npm v10.0.4 和 Node.js v20.11.0 进行过测试。
Composer
安装说明
如果您之前从未使用过 Composer,请确保您已阅读 Composer 文档中的
Composer 基本用法
部分。
选择 DotKernel frontend
的安装路径
示例
- 绝对路径
/var/www/dk
- 或相对路径
dk
(等同于./dk
)
安装 DotKernel frontend
选择 DotKernel 前端(本例中使用 dk
)的路径后,让我们继续安装。
注意
安装使用 PHP 扩展 ext-intl
,该扩展可能默认未在您的 Web 服务器上启用。如果安装返回与以下类似的错误,请检查您的 php.ini
中的 extension=intl
扩展。
Your requirements could not be resolved to an installable set of packages. Problem 1 - laminas/laminas-i18n 2.10.3 requires ext-intl * -> the requested PHP extension intl is missing from your system.
要启用扩展,请删除其前面的分号 (;)。
使用 git clone 安装 DotKernel frontend
此方法确保安装了默认分支,即使它尚未发布。运行以下命令:
git clone https://github.com/dotkernel/frontend.git .
必须单独安装依赖项,运行以下命令:
composer install
设置脚本会提示一些配置设置,例如以下行:
Please select which config file you wish to inject 'Laminas\Diactoros\ConfigProvider' into: [0] Do not inject [1] config/config.php Make your selection (default is 1):
只需选择 [0] 不注入
,因为 DotKernel 包含自己的 configProvider,它已经包含了提示的配置。
如果您选择 [1] config/config.php
,则 Laminas 的 ConfigProvider
中的 session
将被注入。
下一个问题是:
记住此选项以用于同一类型的其他包? (y/N)
配置 - 首次运行
- 将
config/autoload/development.local.php.dist
复制为config/autoload/development.local.php
- 将
config/autoload/local.php.dist
复制为config/autoload/local.php
- 将
config/autoload/mail.local.php.dist
复制为config/autoload/mail.local.php
- 根据您的开发机器编辑
config/autoload/local.php
并填写database
配置。
配置 - 邮件(可选)
如果您希望应用程序在注册、联系等情况下发送邮件,请将有效凭证添加到以下 config/autoload/mail.local.php
中的键:
在 message_options
键下:
from
- 将发送电子邮件的电子邮件地址(必需)from_name
- 在发送的电子邮件上签名的组织名称(可选)
在 smtp_options
键下:
host
- 邮件服务器的主机名或 IP 地址(必需)connection_config
- 添加username
和password
键(必需)
在 config/autoload/local.php
中编辑 contact
=> message_receivers
=> to
键,使用 字符串 值填充应接收联系信息的电子邮件地址。
注意:**请至少添加 1 个电子邮件地址,以便联系信息能够送达某人**
您还可以在 contact
=> message_receivers
=> cc
键下添加任意多的抄送人。
配置 - reCAPTCHA(可选)
reCAPTCHA用于防止您的网站上的滥用行为。DotKernel前端使用Google reCAPTCHA来处理联系我们表单。您必须首先在您的Google账号中生成一个siteKey
和secretKey
- 请访问Google reCAPTCHA
更新config/autoload/local.php
中的recaptcha
数组,并添加Google reCAPTCHA的siteKey
和secretKey
。
注意:在开发过程中,您需要在reCAPTCHA设置页面上将localhost
添加到白名单。在生产环境中,不要忘记从reCAPTCHA白名单中删除localhost
,或者使用一个独立的reCAPTCHA。
数据库迁移
使用以下命令执行数据库迁移
php vendor/bin/doctrine-migrations migrate
注意:如果您已经运行了phinx迁移,可能会收到此消息
WARNING! You have x previously executed migrations in the database that are not registered migrations. {migration list} Are you sure you wish to continue? (y/n)
提交y
后,您将收到此确认消息。
WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (y/n)
再次提交y
以按时间顺序运行所有迁移。每次迁移都会记录在migrations
表中,以防止多次运行相同的迁移,这通常是不希望的。
数据库播种(固定值)
使用我们的自定义包dotkernel/dot-data-fixtures
(基于doctrine/data-fixtures构建)来帮助进行数据库播种。要执行所有固定值,请运行
php bin/doctrine fixtures:execute
开发模式
运行此命令以通过将调试标志设置为true
并将配置缓存设置为off
来启用开发模式。它还将确保清除任何现有的配置缓存。
composer development-enable
- 如果尚未完成,请从
config/autoload/development.global.php.dist
中删除.dist
扩展名。
NPM命令
要安装到node_modules
目录的依赖项,请运行此命令。
npm install
- 如果
npm install
失败,这可能是由npm的用户权限引起的。建议通过Node Version Manager
安装npm。
监视命令编译组件,然后监视文件,并在其中一个文件更改时重新编译。
npm run watch
更新完成后,此命令将在本地编译资源,压缩它们,并使它们准备好用于生产。
npm run prod
运行应用程序
我们建议在WSL中运行您的应用程序
- 请确保您的系统上已安装WSL
- 目前,我们为AlmaLinux9提供发行版实现
- 按照所选发行版的建议在虚拟主机中安装应用程序
- 在
config/autoload/local.php
中设置$baseUrl
为虚拟主机的地址 - 通过在浏览器中打开虚拟主机地址来运行应用程序
您应该会看到DotKernel Frontend
欢迎页面。
注意
- 如果您遇到了有关某些缺失服务的异常或错误,请尝试运行以下命令
sudo php bin/clear-config-cache.php
如果存在
config-cache.php
,则无论config/autoload/mezzio.global.php
中的ConfigAggregator::ENABLE_CACHE
如何,都会加载该配置
- 仅开发:由于本地不支持
session.cookie_secure
,请确保您已修改local.php
,如下所示
# other code return [ # other configurations... 'session_config' => [ 'cookie_secure' => false, ], ];
不要在local.php.dist
中更改此内容,因为此值在生产环境中应保持为true
。