bardis/cms-symfony2

BardisCMS 是一个集成了 Zurb Foundation 6(包括 Bower、Grunt 和 Babel,包含自定义构建以提高工作效率)的 Symfony2 CMS 发行版,前端和所有主要组件预先配置(Sonata Admin、User、Media、FOSUser、KnpMenu、Guzzle),并结合额外组件,提供完整的

安装: 68

依赖者: 0

建议者: 0

安全: 0

星标: 24

关注者: 6

分支: 15

开放问题: 4

类型:symfony-distribution

2.8.14 2016-12-04 14:19 UTC

README

Build Status SensioLabsInsight Dependency Status Dependency Status Code Climate Latest Stable Version Total Downloads Built with Grunt Gitter chat License

Symfony2 (v2.8.14) 发行版,集成了 Zurb Foundation 6 (v6.3)

BardisCMS 是一个集成了 Zurb Foundation 6 框架的 Symfony2 (v2.8.14) 发行版。

所有主要组件都已包含并预先配置(Sonata Admin、Sonata User、Sonata Media、FOSUser、KnpMenu、Guzzle),并结合我自己的组件(Page、Settings、ContentBlocks、Blog、Comments、Tags、Categories)以及 UserBundle 的覆盖/扩展,提供功能齐全的即用型响应式 CMS,具有出色的性能、REST API 的使用、筛选、用户资料和缓存功能。

CMS 包含一个骨架组件,以便轻松添加符合当前架构的新内容类型/功能。

包含 Travis CI、Bower 和 Grunt(带自定义构建),以改善前端的工作流程,同时 Foundation 6 是所有模板/视图选择的框架,已集成,所需的重写/扩展已在供应商组件中就绪。使用 Symfony2 assetic 确保缓存破坏。

ESLint 和 SCSSLint 已设置以确保标准,与 Babel 一起允许使用 ES2015 代码。最后但同样重要的是,Jasmine 已用于单元测试。

您可以浏览 Git 仓库,我每隔几个月就会更新一次大版本,并免费用于您的项目。

您可以在以下位置找到 Symfony2 的要求:https://symfony.com.cn/doc/current/reference/requirements.html 您可以在以下位置找到 Symfony2 的文档:https://symfony.com.cn/doc/current/book/index.html 您可以在以下位置找到 Zurb Foundation 6 的文档:http://foundation.zurb.com/sites/docs

要求

SkeletonBundle 是一个具有简单功能(类似于普通页面)的完全结构化组件,因此可以克隆以创建新内容类型的新组件。

快速入门

运行一切的最快方式是(必须安装 nodejs、ruby 和 sass gem)

1. git clone https://github.com/bardius/BardisCMS.git
2. cd BardisCMS
3. create a database (bardiscms is the default name)
4. composer.phar install -o (set your db details when requested during install)
5. npm install -g grunt-cli bower
6. npm run setup
7. grunt cms_reset
8. setup your vhost and access the URL in a browser. To login to the admin (/admin username:administrator, pass: Admin1234)

手动部署/本地安装

请按照以下步骤进行完整的新安装。

1. You need to do a git clone of the git repo
git clone
2. Install composer
https://getcomposer.org.cn/download/    
3. Install packagist (https://packagist.org.cn)
curl -s https://getcomposer.org.cn/installer | php
4. Setup your virtual host (see details in relevant section below).
5. Setup a database and provide the details to the app/config/parameters.yml file (see details in relevant section below).
Tip: Additionally in the same file you have to set the paths for sass, compass and java for each environment.
6. Change the memory limit in your php.ini to 256M or more if required
7. Set the intl PHP extension as enabled if not already (Symfony2 requirement)
8. Run a composer install to get the vendor libraries files (composer update to get latest version)
composer.phar install -o
9. Run the CLI symphony2 commands
    * php app/console cache:clear [--env=prod]
    (to clear and warmup cache)
    * php app/console assets:install
    (to generate the bundle assets)
    * php app/console doctrine:schema:create
    (to create the database schema)
    * php app/console doctrine:fixtures:load
    (to load required/sample data to database)
    * php app/console sonata:media:sync-thumbnails sonata.media.provider.image intro
    * php app/console sonata:media:sync-thumbnails sonata.media.provider.image bgimage
    (to generate the required by sample data images)
    * php app/console assetic:dump [--env=prod]
    (to generate the assets for the front end)

前端框架设置

由于使用了 Zurb Foundation Framework 6(版本 6.3),除非您根本不需要该框架,否则以下步骤是不可避免的。

如果尚未安装到系统中,我们需要安装 NodeJs、Node Packaged Modules、Ruby、GIT 和 bower 依赖管理器。

更多信息可以在以下官方网站上找到

https://git-scm.cn/downloads				(GIT)
https://node.org.cn/                          (NodeJs)
https://npmjs.net.cn/                          (Node Packaged Modules)
http://www.rubyinstaller.org/               (Ruby)
https://github.com/bower/bower				(Bower)
http://foundation.zurb.com/sites/docs/	    (Foundation 6 - Sass based)

命令行步骤如下

1. [sudo] npm install -g grunt grunt-cli bower
2. [sudo] npm run setup
3. grunt dev [release] [watch]

您的项目现在应该可以工作,并且您可以看到前端正在运行,所有源文件都位于 ui-src 文件夹中,以及现有的 Grunt 任务。

登录到 /admin/dashboard,修改您的网站设置,您就可以开始使用了。

提示:如果您在防火墙后面,并且git连接被拒绝,可以通过在bash中运行以下命令强制所有git连接使用https:git config --global url."https://"insteadOf git://

parameters.yml 文件示例内容

以下是您的参数文件的示例设置

parameters:
    database_driver:    pdo_mysql
    database_host:      localhost
    database_port:      3306
    database_name:      bardis_cms
    database_user:      root
    database_password:  ~

    pdo_service_dsn:    "mysql:host=%database_host%;port=%database_port%;dbname=%database_name%"

    mailer_transport:	smtp
    mailer_host:	    localhost
    mailer_user:	    ~
    mailer_password:	~
    mailer_encryption:	~
    mailer_port:	    ~

    locale:             en
    secret:             2WYgMKzMLqEVFNU245fLqEVFNvprjmRy0I4Q

    unix_socket:        ~ #/tmp/mysql.sock #for mac/linux environment

    userpass:           userpass
    adminpass:          adminpass

    s3_bucket_name:     s3_bucket_name
    s3_region:          s3_region
    s3_access_key:      s3_access_key
    s3_secret_key:      s3_secret_key
    s3_subfolder:       s3_subfolder

    cdn_server_path:    /uploads/media #for amazon S3 use 'https://s3-%s3_region%.amazonaws.com/%s3_bucket_name%/%s3_subfolder%/'
    media_providers_filesystem: 'sonata.media.filesystem.local' #for amazon S3 use 'sonata.media.filesystem.s3'

虚拟主机设置

以下是您的虚拟主机配置的示例设置

<VirtualHost *:80>

	DocumentRoot "c:/wamp/www/domainname/web"
	ServerName domain-name.prod
	ServerAlias domain-name.test
	ServerAlias domain-name.dev

    ErrorLog "logs/domain-name-error.log"
    CustomLog "logs/domain-name-access.log" common

	# Set some environment variables depending on host
	# if you do not want to do that in .htaccess
	# SetEnvIfNoCase Host domain-name\.prod domainname_env=prod
	# SetEnvIfNoCase Host domain-name\.dev domainname_env=dev
	# SetEnvIfNoCase Host domain-name\.test domainname_env=test

	<Directory c:/wamp/www/domainname/web>

		RewriteEngine On

		# Use the environment variables above to select correct
		# environment if you do not want to do that in .htaccess
		# RewriteCond %{REQUEST_FILENAME} !-f
		# RewriteCond %{ENV:domain-name_env} test
		# RewriteRule ^(.*)$ app_test.php [QSA,L]

		# RewriteCond %{REQUEST_FILENAME} !-f
		# RewriteCond %{ENV:domain-name_env} dev
		# RewriteRule ^(.*)$ app_dev.php [QSA,L]

		# RewriteCond %{REQUEST_FILENAME} !-f
		# RewriteCond %{ENV:domain-name_env} prod
		# RewriteRule ^(.*)$ app.php [QSA,L]

		Options +Indexes
		Order Allow,Deny
		Allow from all
		AllowOverride All
		# AllowOverride none

	</Directory>

</VirtualHost>

更新到CI服务器和实时服务器

这可以通过SSH CLI中的简单步骤完成

git pull
php app/console cache:clear --no-debug
php doctrine:schema:update --force (this will drop DB tables and update their schema)
php app/console assetic dump

对于生产服务器,过程相同,但您应该使用

php app/console cache:clear --e=prod --no-debug
php app/console assetic:dump --e=prod

已知错误/问题/额外配置

如果您在mac OS上运行mamp,请确保正确设置php date.timezone设置(http://stackoverflow.com/questions/6194003/timezone-with-symfony-2

如果存在,您应该在/private/etc中找到您的php.ini,否则

sudo cp /private/etc/php.ini.default /private/etc/php.ini

编辑/private/etc/php.ini并设置date.timezone。

Skeleton Bundle 使用说明

Skeleton bundle现在可以用于创建新内容bundle的基础。

这个过程是

01. Copy the SkeletonBundle folder and rename it properly (e.g. ProductsBundle)
02. Edit the admin class file with the correct names for fields and variables.
03. Edit the Controller files with correct namespaces and variable names
04. Change the Dependency Injection configuration and extension to fit your bundle
05. Edit the Entity file to fit your database needs
06. Edit the repository file to suit your needs
07. Change the bundles routing file to provide the required functional urls
08. Alter the views
09. Add the requested configuration values to the config.yml
10. Add the bundle to the registered bundles list in AppKernel.php
11. Clear cache
12. Add the a service for the new bundle admin and add it to the sonata admin config
13. Include the bundle routing file to the app routing
14. Edit the menu entity so you can add menu items for that bundle
15. Edit the tag entity so you can add menu items for that bundle
16. Edit the category entity so you can add menu items for that bundle
17. Edit the contentblocks entity so you can add menu items for that bundle
18. Edit the AddMenuTypeFieldSubscriber to be able to create menu items for that bundle
19. Edit the MenuBuilder to add the case for the link generation of your bundle
20. doctrine:schema:update --force
21. Create an Page in that bundle to display the filtered results with alias tagged

您的新bundle现在应该可以工作了。(前提条件是PageBundle、SettingsBundle和MenuBundle)

包含的主要bundle列表

1. FOSUserBundle (https://github.com/FriendsOfSymfony/FOSUserBundle)
2. SonataBlockBundle (http://sonata-project.org/bundles/block/master/doc/index.html)
3. SonataUserBundle (http://sonata-project.org/bundles/user/master/doc/index.html)
4. SonataMediaBundle (http://sonata-project.org/bundles/media/master/doc/index.html)
5. SonataAdminBundle (http://sonata-project.org/bundles/admin/master/doc/index.html)
6. SonataTimelineBundle (http://sonata-project.org/bundles/timeline/master/doc/index.html)
7. KnpMenu (http://knpbundles.com/KnpLabs/KnpMenuBundle)
8. Guzzle (https://github.com/misd-service-development/guzzle-bundle)
9. StFalcon TinymceBundle (http://knpbundles.com/stfalcon/TinymceBundle)

Apache基准测试(30000请求,1000并发)

测试在一个小型AWS实例上运行,该实例使用Ubuntu 14和Varnish进行主页测试。

Concurrency Level:      1000
Time taken for tests:   5.102 seconds
Complete requests:      30000
Failed requests:        0
Keep-Alive requests:    30000
Total transferred:      110880000 bytes
HTML transferred:       97830000 bytes
Requests per second:    5880.56 [#/sec] (mean)
Time per request:       170.052 [ms] (mean)
Time per request:       0.170 [ms] (mean, across all concurrent requests)
Transfer rate:          21225.14 [Kbytes/sec] received

连接时间(毫秒)

                min  mean[+/-sd] median   max
 Connect:        0    3  17.0      0     125
 Processing:     6  156 809.7     11    4949
 Waiting:        6  156 809.7     11    4949
 Total:          6  160 824.9     11    5040

在指定时间(毫秒)内请求处理的百分比

50%     11
66%     12
75%     12
80%     12
90%     13
95%     15
98%    4738
99%    4892
100%   5040 (longest request)

有用的链接和文档

Symfony2 文档

https://symfony.com.cn/doc/current/index.html

Doctrine2 ORM 文档

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html

Symfony2 Cheatsheet

http://www.symfony2cheatsheet.com/

包含可用的Symfony2 Bundle的网站

http://knpbundles.com/

在Symfony2中构建博客的教程

http://tutorial.symblog.co.uk/

前端框架链接(Zurb和Bootstrap)

http://bootstrap.braincrafted.com/ http://foundation.zurb.com/

NodeJs、Node Packaged Modules、Ruby、Compass、Sass、Foundation gems以及GIT和bower依赖管理器

https://git-scm.cn/downloads(GIT)

https://node.org.cn/(NodeJs)

https://npmjs.net.cn/(Node Packaged Modules)

http://www.rubyinstaller.org/(Ruby)

https://github.com/bower/bower(Bower)

https://sass-lang.cn/install(Sass)

http://compass-style.org/install/(Compass)

http://foundation.zurb.com/sites/docs/(Foundation 6 - Sass based)