elfet / silicone-skeleton
此包已被废弃,不再维护。未建议替代包。
v1.0.1
2013-11-27 13:45 UTC
Requires
- php: >=5.3.0
- doctrine/common: ~2.2
- doctrine/dbal: ~2.2
- doctrine/orm: ~2.2
- elfet/silicone: ~1.0
- monolog/monolog: ~1.0
- silex/silex: ~1.0
- silex/web-profiler: 1.0.*@dev
- symfony/config: ~2.1
- symfony/form: ~2.1
- symfony/locale: ~2.1
- symfony/security: ~2.1
- symfony/translation: ~2.1
- symfony/twig-bridge: ~2.1
- symfony/validator: ~2.1
- symfony/yaml: ~2.1
- twig/twig: ~1.8
This package is not auto-updated.
Last update: 2020-01-24 15:11:02 UTC
README
Silicone Skeleton 是 Silex 框架版本骨架。
每个部分都是可配置的。你可以选择任何你想要的东西。
此 Silex 修改包含以下内容
- HttpCache
- 类控制器
- Doctrine Common
- Doctrine ORM
- Monolog
- Session
- Twig
- 翻译
- 验证器
- 实体的唯一验证器
- 表单
- 安全
- 用户注册和授权。
- 注解路由
- WebProfiler(带 Doctrine 查询记录器)
- 控制台
结构
Silicone 的结构非常类似于 Symfony。
app/
config/ -- Configuration
lang/ -- Language Yml, Xliff files
open/ -- Writable directory for caches, logs, ext.
src/ -- Application sources
vendor/ -- Vendors
view/ -- Twig view files
console -- Console Tool
web/
index.php
控制器
你可以使用 Silex 控制器 $app->get(...)
与类控制器。
class Blog extends Controller { /** * @Route("/blog/{post}") */ public function post($post) { return $this->render('post.twig'); } }
Doctrine ORM
你可以使用所有 Doctrine ORM 功能,不仅仅是 DBAL。创建文件 app/src/Entity/Post.php
namespace Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity */ class Post { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue */ protected $id; /** * @ORM\Column * @Assert\NotBlank() * @Assert\Length(min = "3", max = "1000") */ protected $text; }
之后只需运行
app/console schema:update
安装
使用 Composer 创建一个新项目
composer create-project elfet/silicone-skeleton your/app/path
打开用于写入缓存、日志等的目录。因此,你必须为 www-data 用户授予写入权限。例如
sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/open/
sudo chmod +a "[your user name] allow delete,write,append,file_inherit,directory_inherit" app/open/
添加执行控制台命令的权限。例如
chmod +x app/console
数据库
配置控制台后,运行以下命令以创建示例数据库
app/console database:create
app/console schema:create
待办事项
- 文档
- 测试
- SwiftMailer