Code Monkey home page Code Monkey logo

yiiboilerplate's Introduction

YiiBoilerplate

Structure for enterprise-grade websites for Yii framework. Already thought-out.

While making websites with Yii framework for medium-sized businesses over and over again, we adopted a standard way of structuring the project over time. It was initially based on the following premises:

  1. Separate public ("frontend") and administrator's ("backend") sides to different domains for security purposes.
  2. Have an application configuration modular, so we can have parts of it committed to VCS repository for everyone and parts of it being crafted for every specific developer.

This two premises have lead to significant changes from the traditional project structure, described in Yii tutorial. It even affected the terminology, creating two new terms "entry point" and "environment".

For quite some time we were building Yii-based websites using this structure and it proved really effective. This article will describe to you the all-new YiiBoilerplate with all the new features added in that time.

We do really hope that you'll benefit from this boilerplate project template.

Being a Boilerplate

We must make a note first that YiiBoilerplate is neither a library nor an another framework. It's a boilerplate, stuff you use as a starting point for your work.

As a consequence of this, do not bother thinking about "updates" or "future versions" of YiiBoilerplate after you started your project over it. Just adapt it to your needs as you wish.

Requirements

  • PHP 5.4. Seriously, even Debian Stable, notorious for slow library upgrades, has version 5.4 now. Upgrade right now and/or stop using hosting providers with old PHP versions.
  • Probably, enabled support for running PHAR archives from console (it has to be enabled via php.ini).
  • Optional: Java to be able to run Selenium.
  • Optional: Virtualbox and Vagrant for the easiest local deploy ever.

Easiest initial deploy ever

  1. Install Vagrant (not covered by this article).

  2. Install Virtualbox (not covered by this article).

  3. If you have PHP 5.4+ installed already (and you should have, because it's awesome), you've just installed all prequisites for YiiBoilerplate.

  4. Now just clone the YiiBoilerplate repo:

    git clone [email protected]:clevertech/YiiBoilerplate.git <yourprojectname>
    
  5. Inside cloned directory run and wait for complete:

    vagrant up
    

    Vagrant can complain about versions of VirtualBox Guest Additions and Virtualbox itself being different. This is solved by running vagrant plugin install vagrant-vbguest, the only non-obvious step you should encounter so far.

  6. You're done. Open up the http://localhost:8080/. It's your future frontend. Open up http://localhost:8081/. It's your future backend. You can start working. Don't forget to vagrant halt the virtual machine before turning off your workstation, virtualbox can fail to shut itself down in time before kill -9 arrives.

Manual preparations

Consult the carcass/vagrant/prepare-precise64.sh and carcass/vagrant/setup-app.sh scripts for example.

Get a full health report for a project

We integrated almost everything from the PHP QA Tools project, over the Phing build system.

To get all possible static code analysis reports for your project and the API documentation, just run:

bin/phing

It will generate the following reports in the reports folder:

  • Report of the code style violations in Checkstyle format from PHP Code Sniffer
  • Code coverage report in Clover format from PHPUnit
  • Code duplications report in XML from PHP Copy-Paste Detector
  • Codebase size report in XML from PHPLOC
  • Various problems report in XML from PHP Mess Detector
  • Report in XML from PDepend
  • Two code metrics schematics in SVG from PDepend
  • Code coverage report in HTML format from PHPUnit
  • HTML pages tree with all of your codebase with all above problems highlighted from PHP Code Browser
  • and, finally, the autogenerated API documentation in HTML from ApiGen.

We believe it'll be sufficient for you to get an idea about the state of your codebase. Of course to generate code coverage reports this reporter has to run all unit tests, too, so you get regression testing as a side effect, assuming that your unit tests are really fast.

Overview

Now, let's delve into internals.

YiiBoilerplate was designed for medium-sized Yii-based web applications of any kind. By "meduim-sized" we mean 10 to 100 unique routes. Again, it has a harness to support two-tier test-first development, with Behat for end-to-end acceptance tests and PHPUnit for both pure unit tests and integration tests.

Basically, YiiBoilerplate is a bunch of files and folders you commit to your VCS repo as your "initial commit", then start working for real. It consists of a proof-of-concept website, having one-page blank frontend and an admin side with rudimentary UI and a password-based authentication already done.

You can read the whole "table of contents" for the various directories of the YiiBoilerplate in README.md files inside that directories.

Top-level Directories

  1. backend

    Backend entry point, expected to be your "admin side" of the application.

  2. bin

    Binaries for you to use, including yiic, phing, phpunit and such. Note that while most of binaries are Composer-installed, yiic and selenium launchers are hand-crafted and not supposed to be removed/changed.

  3. carcass

    Configuration for various 3rd-party tools used in project harness, including Vagrant stuff and code style definition for CodeSniffer.

  4. common

    This folder is structured similarly to the traditional protected folder in autogenerated Yii application. You are expected to place the code global to all entry points in common. Backend-, frontend-, and console-specific stuff should go to backend, frontend and console dirs, respectively.

  5. console

    Console entry point, reachable by yiic console runner. Most important stuff here is your migrations, inside console/migrations subfolder.

  6. frontend

    Frontend entry point, expected to be public side of your application.

  7. reports

    All project status reports from various code quality tools will be placed in here. Documentation from APIGen, too. You will not see this directory initially, it's auto-generated when needed.

  8. tests

    Your test harness is here. See details in the README.md there.

  9. vendor

    All third-party dependencies are installed by Composer in here, even Selenium. You will not see this directory initially, it's auto-generated when needed.

Configuration tree

Most complex part of the YiiBoilerplate application is the configuration, built from set of different parts.

Basically, configuration for backend, console and frontend entry points is being constructed from the following parts, later ones overriding previous ones:

  1. Base common config.
  2. Environment-specific common config.
  3. Local overrides for common config.
  4. Base entry point-specific config.
  5. Environment-specific entry point-specific config.
  6. Local overrides for entry-point-specific config.

For frontend entry point the corresponding files would be:

  1. common/config/overrides/base.php
  2. common/config/overrides/environment.php
  3. common/config/overrides/local.php
  4. frontend/config/overrides/base.php
  5. frontend/config/overrides/environment.php
  6. frontend/config/overrides/local.php

Local overrides and environment overrides can be absent.

You can trace the resulting tree of require calls starting from frontend/config/main.php file. That's the file you really use as the configuration file for application. In reality it's just a four-line builder constructing the resulting configuration tree from six different parts specified above.

Local overrides

Local overrides are simple. That's the snippets of configuration containing the non-portable parts like database access credentials.

config/overrides subdirectory in all of common, frontend, console and backend directories contains the local-example.php file which you can copy as local.php and immediately use.

These overrides are not to be committed to the repository as they contain the settings specific to each developer's machine.

Environment overrides

Configuration snippets for different environments are placed inside config/environments directories. You can specify things there like the different database paths, caching mechanisms, some OS-specific parameters, or anything you want. To activate the desired environment, you are expected to copy needed configuration snippet from inside config/environments subdir and place it into config/overrides/ under the name environment.php. As it's an obviously mundane and boring to hell task it's automated for you by invoking the following command:

bin/yiic environment set --id=<environmentname>

Of course, each config/environments subdirectory in all of entry points should have a configuration snippet named <environmentname>.

Environment overrides are to be committed to the repository as they contain the proven set of settings intended to adapt the application to different working conditions.

Nothing forces you to really use this system of environment-specific settings. Configuration builder will happily live without these files.

Vagrant

YiiBoilerplate includes Vagrant harness which you can use as you wish. Vagrantfile is set up to use the default precise64 box, which is Virtualbox image loaded with blank Ubuntu 12.04.

As YiiBoilerplate is a rudimentary web application, we prepared a set of scripts to deploy it to Vagrant virtual machine. They are located at carcass/vagrant subdirectory. Two scripts, which are used as provisioning scripts for Vagrant, can be used as an examples of automatic deploy of the YiiBoilerplate application to any *nix-based system:

  • prepare-precise64.sh is a script to install the required tech stack for common database-backed web application to Ubuntu 12.04: PHP 5.4, apache, mysql, git etc. and create the database.
  • setup-app.sh is a script to install the application to prepared system: generate configs, required runtime directories, install dependencies.

You are encouraged to read through them yourself, they're not so hard to comprehend.

Note that in default installation after each vagrant provision call you will have to wait until all three apt-get update calls finish. This is time-consuming. To relieve yourself from this burden, you can safely pack the machine created by initial vagrant up to the custom Vagrant box and reference this box instead of generic precise64. This way you'll safely remove prepare-precise64.sh from the provisioning scripts list in Vagrantfile.

If you did not understand a word from the preceding paragraph, consult the documentation about vagrant box repackage command and the documentation about provisioning on Vagrant site.

Composer

All 3rd-party components of YiiBoilerplate, including Yii itself, are managed by the Composer. You get Behat+Mink+MinkExtension, PHPUnit, full stack of PHP Quality Assurance toolchain, Phing, ApiGen, Yii and YiiBooster as your dependencies. Even Selenium was packaged into Composer so it's being installed, too.

Using Composer greatly reduces the size of your application codebase checked into the repository. To ensure that everyone in your team gets exactly the same versions of the 3rd-party software, Composer generates a special file called composer.lock, which you commit to the repository instead of the whole vendor folder, and the presense of this file will indicate to Composer what exact versions of software to maintain in a given codebase. YiiBoilerplate repo contains such a file so you can be reasonably sure that at least its developers managed to run boilerplate application using the set of dependencies specified in there.

composer.json was tweaked so you will get all executables inside bin subdirectory.

Phing

Most possibly you'll need the build system for your application, so we included the PHP-based one, namely, Phing.

Build file included in YiiBoilerplate contains the targets allowing you to generate the comprehensive set of reports about the health of your application.

Results of running the default target by issuing bin/phing from root of codebase was already described before.

Please note that the set of source directories for each different tool being run by Phing is specified in separate build file carcass/filesets.xml. We're sorry, but various directories excluded from analysis you have to hack inside the main build file, in case you'll change the structure of a project.

Yiic

Usual console runner from Yii was moved to bin subdirectory. As Composer is configured to install executables into the same directory, it was done to prevent you from using the default console runner instead of the one built-in to YiiBoilerplate, which you have total control over.

Whole console subdirectory is for this console entry point to the application.

So, to run any console command built-in to Yii or defined by you in console/commands, you have to run bin/yiic <command> from root of codebase (instead of more short ./yiic).

We have found this an acceptable trade-off.

Behat

As an acceptance tests driver we included Behat+Mink+MinkExtension combo over the Selenium2 driver.

This gives you arguably the best PHP-based acceptance testing solution out there. Gherkin syntax allows you and your QA team and perhaps even your client to specify the desired behavior of the application in human language, which is the clear win. Selenium uses real browser to manipulate the web GUI of your application, and does this insanely fast, so you will not need to cope with any of shortcomings of the headless browsers like phantomJS or Zombie.

All required configuration was already done. behat.yml config file is placed into the root of codebase for your convenience, so you'll be able to run Behat without the hassle of specifying the path to config file in command line arguments. You need to do only one thing: place a config called behat-local.yml into the root of codebase, in which you specify the only non-portable setting: base URL for Mink to be able to connect to your web application. If you run Vagrant virtual machine, provisioning script will place the behat-local.yml pointing to its URLs automatically. So you can look at carcass/vagrant/behat-local.yml file to understand what is needed from you.

If you use the default setup based on Selenium, you have to run the bin/selenium helper script which just launches Selenium, taking up one console terminal.

All of your specs related to frontend are expected to be placed into tests/specs/frontend. You run them all using the simple invocation bin/behat -p frontend.

All of your specs related to backend are expected to be placed into tests/specs/backend. You run them all using the simple invocation bin/behat -p backend.

Both sets of the specs use the same context class located in the tests/specs/contexts/FeatureContext.php. All of your test steps definitions should be placed there. Please note that a single FeatureContext class is just a starting point, nothing prevents you from structuring your acceptance test harness as you see fit.

PHPUnit

For unit testing we included the PHPUnit library as the Composer dependency. Its executable is in bin, along with all other executables, and by default you run all unit tests at once, as they have to be crazy fast anyway. Its phpunit.xml config file is placed in the root of codebase for your convenience, so you'll be able to run PHPUnit as bin/phpunit and be freed from specifying the path to config file.

Config file we included in YiiBoilerplate does not have any code coverage setup definitions. To get a code coverage you are expected to use Phing target named coverage as follows: bin/phing coverage, which specifies code coverage settings using command line switches.

Our intention was to make a harness to support only pure isolated unit tests, so you get totally clean environment inside test cases. In case where you need the integration test, we prepared the bootstrap script for PHPUnit which does the common initialization of YiiBoilerplate application as defined in common/bootstrap.php and does some tricks the same way yiit.php script does. This bootstrap script is essentially the fourth entry point to your application.

So when you run:

bin/phpunit --bootstrap carcass/phpunit.bootstrap.php

You run your test cases in the environment where the Yii class is defined and all usual setup is done so you can freely instantiate WebApplication instances as you see fit and using any configuration you want in your tests.

YiiBooster

For backend side of the application, we included our other library, YiiBooster as a Composer dependency, and made the configuration required to attach it.

So, in effect, you'll get the total power of YiiBooster to make the UI of your backend. You are expected to skim through the YiiBooster documentation to learn what widgets you get from this toolkit.

Frontend, in contrast, is completely blank HTML5Boilerplate, because judging from our own experience, public side of the application is unique for every project anyway, so default styles from Twitter Bootstrap will not find any place there.

License

All of the code by default is licensed by BSD license, as all opensource work from Clevertech.

However, as you most possibly will change everything inside the codebase over time, you can probably treat the code as being in public domain. Our terms and intention is that you can adapt anything inside YiiBoilerplate to your needs.

phpStorm tweaks

To fully utilize phpStorm's autocompletion feature we have to do some tweaks to instruct it to ignore some files from 3rd-party libraries.

  1. We use our custom Yii class, to utilize the F4 button over the Yii::app() invocation and to regain control over this singleton in general. However, this leads to duplicate definitions as far as phpStorm is concerned.

    1. In File -> Settings -> PHP under Include Path section find the entry ending in yiisoft/yii entry and change it so it will end in yiisoft/yii/framework.
    2. Similarly change the entry ending in clevertech/yii-booster so that it ends in clevertech/yii-booster/src.
    3. In File -> Settings -> File Types under Ignore files and folders section append the string ;framework/Yii.php;tests/fakes/Yii.php verbatim.
  2. Also, Behat distribution shipped with Composer includes the FeatureContext class which conflicts with our own. In File -> Settings -> PHP under Include Path section find the entry ending in behat/behat and append src to it. This will exclude the tests code from Behat library index.

Please note that due to the indexing mechanism of phpStorm you will either need to change the PHP include paths each time you make changes in composer.json or to disable the auto-reindexing of Composer-installed libraries altogether.

Side note regarding phpStorm usage with Yii-based applications: if you want Yii application components to be accessible by hitting F4 over the component name in expressions like Yii::app()->request, you have to write @property doc blocks for your WebApplication class assigning proper class names to the component IDs. It increases human-readability, too.

====

Clevertech
well-built beautifully designed web applications
www.clevertech.biz

yiiboilerplate's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yiiboilerplate's Issues

Gii Module

Hello im trying to make a new model and for that i need gii.

at the moment it doesnt open like this.

http://localhost/mysite/backend/gii

i have uncommented gii module in main.php residing in backend/config folder.

the DB credentials are provided in common/config though since db will be shared by both frontend and backend.

URL rules not working

Hi,

I've cloned github repo inside my webroot dir (apache mod_rewrite enabled), Set RewriteBase to /YiiBoilerplate/backend/www (backend's .htaccess) Browsed http://localhost/YiiBoilerplate/backend/www and when i click on links about, contact or login i get a 404 error

http://localhost/YiiBoilerplate/backend/www/site/page/?view=about http://localhost/YiiBoilerplate/backend/www/site/contact/ http://localhost/YiiBoilerplate/backend/www/site/login/

What I'm missing?

Regards, Rodrigo

'Remember me next time' checkbox tuning

When you try to login and check 'Remember me next time' from clean YiiBoilerplate it gives exception. So should add
'user' => array(
'allowAutoLogin'=>true,
),
to bacjend configuration file

OR

just check if it enabled before we will print that checkbox.

admin advance search issue

the advance search is not working for gii generated fields using this structure seems not working . please verify it

Problem with CCookieCollection::add in Yii v1.1.11

Current YiiBoilerplate version contains Yii framework v1.1.11. It should be upgraded to v1.1.12 because the previous Yii version has a problem with CCookieCollection displaying error message:

"Declaration of CCookieCollection::add() should be compatible with that of CMap::add()"

The issue is fixed in v1.1.12: yiisoft/yii#1091

Params files

Do we need params-* files in console and frontend if we can set that in main-* files as params? Feels like they increase mess in the config files

google chart cannot open

Hi,

i got some problem with google chart visualize, when i add to render partial, chart is not showed up, how come?

any solution?

thanks, and sorry my english is bad

Too many global variables

By the time an action runs the following globals have been defined:

'frontendConfigDir' => '/sites/spin-be/frontend/config'
'root' => '/sites/spin-be/frontend/config/../..'
'paramsLocalFile' => '/sites/spin-be/frontend/config/params-local.php'
'paramsLocalFileArray' => array(...)
'paramsEnvFile' => '/sites/spin-be/frontend/config/params-env.php'
'paramsEnvFileArray' => array(...)
'paramsCommonFile' => '/sites/spin-be/frontend/config/../../common/config/params.php'
'commonConfigDir' => '/sites/spin-be/common/config'
'commonParamsLocalFile' => '/sites/spin-be/common/config/params-local.php'
'commonParamsLocal' => array(...)
'commonEnvParamsFile' => '/sites/spin-be/common/config/params-env.php'
'commonEnvParams' => array(...)
'paramsCommonArray' => array(...)
'params' => array(...)
'mainLocalFile' => '/sites/spin-be/frontend/config/main-local.php'
'mainLocalConfiguration' => array(...)
'mainEnvFile' => '/sites/spin-be/frontend/config/main-env.php'
'mainEnvConfiguration' => array(...)
'config' => array(...)
'app' => WebApplication(...)

Only the last of them seems reasonable (though I won't use it).

The others can be avoided by using an IEFE where needed, for example:

<?php
return call_user_func(function () {
    $commonConfigDir = dirname(__FILE__);

    // get local parameters in
    $commonParamsLocalFile = $commonConfigDir . DIRECTORY_SEPARATOR . 'params-local.php';
    $commonParamsLocal = file_exists($commonParamsLocalFile) ? require ($commonParamsLocalFile) : array();

    // if exists, include it, otherwise set as an empty array
    $commonEnvParamsFile = $commonConfigDir . DIRECTORY_SEPARATOR . 'params-env.php';
    $commonEnvParams = file_exists($commonEnvParamsFile) ? require($commonEnvParamsFile) : array();

    return CMap::mergeArray(
        array(
            // cache settings -if APC is not loaded, then use CDbCache
            'cache.core' => extension_loaded('apc') ?
                array(
                    'class' => 'CApcCache',
                ) :
                array(
                    'class' => 'CDbCache',
                    'connectionID' => 'db',
                    'autoCreateCacheTable' => true,
                    'cacheTableName' => 'cache',
                ),
            'cache.content' => array(
                'class' => 'CDbCache',
                'connectionID' => 'db',
                'autoCreateCacheTable' => true,
                'cacheTableName' => 'cache',
            ),
            // url rules needed by CUrlManager
            'url.rules' => array(
                '<controller:\w+>/<id:\d+>' => '<controller>/view',
                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
            ),
            'php.exePath' => '/usr/bin/php'
        ),
        CMap::mergeArray($commonEnvParams, $commonParamsLocal)
    );
});

Yii update to enable multidimensional params with url

With this version 1.1.12 Yii has still a bug that was tagged resolved in their issue trackers (from revision r1614) but its not true, until they adviced me that 1.1.13 has the fix published.
Update Yii with the latest give the chance to do so

$array_of_keys = array(
    'key1' => 1,
    'key2' => 2
);
$url = Yii::app()->createUrl('mycontroller/myaction', array('id' => $array_of_keys));
// with 1.1.12 generate a PHP Warning (urlencode expects....bla bla)
// with 1.1.13 print correctly http://mydomain/myapp/mycontroller/myaction/?id[key1]=1&id[key2]=2

Unable to find the requested action "view" on backend/www/index

Hi,

I am working with the latest github version 7d2ef07 of this script. Once the default app is setup and working, I am trying to test the actions on the index.php for the default table.

Clicking on any of them doesn't work and leads me to the response page displaying Error 404 The system is unable to find the requested action "view".

Tried searching forums, google etc. but cannot find any help on how to fix it. Any help is much appreciated.

HZ.

Local and env files are still in the repo

Those files are still in history, please untack them:

/backend/config/*-env.php
/backend/config/*-local.php

/frontend/config/*-env.php
/frontend/config/*-local.php

/common/config/*-env.php
/common/config/*-local.php

/console/config/*-env.php
/console/config/*-local.php

Property "TbDataColumn.filterHtmlOptions" is not defined. on CRUD that generate from Bootstrap Generator

I want tu use CRUD using Boostrap Generator, First I create Model ID then using Bootstrap Generator On Left Menu I Fill Model ID and Controller Id, generate and Success, but when I click manaage to display list Data, it got error below:

Property "TbDataColumn.filterHtmlOptions" is not defined.

on line : 54

E:\xampp\htdocs\cashier\protected\extensions\bootstrap\widgets\TbDataColumn.php(54)

How To Solve this?

Enhancement for common/models/User.php

The file has the following function

public function search()
{
.............
$criteria->compare('password', $this->password, true);
.............
}

Since the password is hashed, there can be no such way that password can be searched, and even if the password was searchable, it should not be allowed to search in the first place considering privacy of the users.

Application DATA directory

Nice project!
My question is about data directory that is used for storing information, specific for environment (e.g user uploaded files, generated reports etc).
This directory is not under version control.
how do you arrange it in your structure?

frontend not working.

I have created two virtual host in my windows machine.
www.yiibi.com and
www.admin.yiibi.com

configuration is following

    ServerAdmin [email protected]
    DocumentRoot "C:/xampp/htdocs/YiiBoilerplate/frontend/www"
    ServerName www.yiibi.com
   
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order Allow,Deny
        Allow From All
        



    ServerAdmin [email protected]
    DocumentRoot "C:/xampp/htdocs/YiiBoilerplate/backend/www"
    ServerName www.admin.yiibi.com
   
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order Allow,Deny
        Allow From All
        


Backend is working alright but fronted is not working.

ENH suggestion : More config options on Actions button in Box Widget

Just a enhancement suggestion : The new Box widget is great, it would be nice to be able to customize the Actions button more though.
Llike the type of the button, maybe let the choice between simple button, button group or button dropdown...

Thanks for all your contribution!

.htaccess lost POST when suppress or force the "www." at the beginning of URLs

These rules are the reason that the lost data sent via POST

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

To avoid this, I added the rules

RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC] RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]

NewPassword in User model

NewPassword in User model doesn't make sence and confuse. APasswordBehavior does all the job on update.

URL Question

HI,

This is actually a question and not an issue but could not find anyhere to send them.

Reading through the documentation about the file / folder structure it looks like for a backend and front end structure you would need 2 URL's in apache pointing to the relevant /www folders.

EG:

www.site.com -> /frontent/www

admin.site.com -> /backend/www

Our current websites are currently set up as follows:

www.site.com = frontend

www.site.com/edit = backend

Is there a preferred way to get aound this:

Our possible solutions so far are:

  1. send apache to point to / then add a .htaccess to run the relevant file based on the URL.

As you can imagine this is will not be ideal as it will expose files.

  1. Create symbolic link within /frontend/www called edit to point to /backend/www

Then include .htaccess file to deal with the routing

Thanks

Barry

Дублируется вывод Title

В frontend/views/layouts/main.php два раза выводится тег Title. Вероятно, второй вариант нужно удалить.

I think in .htaccess frontend mistake

I have a standard CentOS 6 not start frontend.

[revin@07701 www]$ uname -a
Linux 07701.corp 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[revin@07701 www]$ httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Feb 13 2012 22:31:42

If any more information on the configuration needed, I can provide. All basic modules of apache installed. If file .htaccess remove, frontend running.

Log on social networks

Good afternoon. It would be great to add functionality to authenticate via social networks. For example you can easily integrate the service ulogin. Of course it ties the implementation of an external service, but this is the simplest solution.

Regards, Roman.

YII_DEBUG depends on env.code

It's possible to add setting 'env.code' using for enabling/disabling debug depend on environment? I searched through the code but never this param not using. Thanks.

v1.0.7 - How to use bootswatch theme ?

Until 1.0.6 version, we simply download bootstrap.css and bootstrap.min.css from http://bootswatch.com/united/ and override YOUR css files.

And ALL was really well working !

Today we downloaded 1.0.7, and we discovered the use of bootstrap.combined.no-icons.css, which probably break the 'override' we want to do.

Now I ask you: How can we use bootswatch theme in 1.0.7 version?

Explain VCS for the YiiBoilerplate in the README

This is a really nice organization of a Yii project and your solutions for handling configurations are particularly helpful.

But it's not obvious to me how users might keep up2date with clevertech/YiiBoilerplate as an upstream. Can you make suggestions in the README?

Behat features writing

Can we write all features in to a FeatureContext.php file or we can split into multiple files? if yes then how can I do that?

Will the current YiiBooster v1.0.7 be included into Boilerplate?

Hello out there,
I am a very happy user of the boilerplate.
I just realized that the current version of Booster is 1.0.7 while the one included in the boilerplate is 1.0.4.
I just tried to update the my 1.04 folders with 1.0.7 but this is breaking a lot of things.

Did anybody manage to update?
Is this necessary at all?

gb5256

how to configure Yii-boilerplate to go for Yii-SES

i am trying to configure a Yii-boilerplate. i still do not understand how to do it.

i am using a single hosted environment, so no development team or local dev machine for now.

i understood I should use environments/params-prod.php and environments/main-prod.php to set up my backend app for a start.

I am using the configs below and running ./runpostdeploy production , every time i change any config file.

what am i doing wrong ?

  • environments/params-prod.php:
    This is to have the application parameters required for the application on production
return array(
    'env.code' => 'prod',
    'connectionString' => 'mysql:host=localhost;dbname=db1',
    'username' => 'uuu',
    'password' => 'zzz',
    // Amazon SES
    'ses.aws.key'=>'xx',
    'ses.aws.secret'=>'yy',
    'ses.aws.verifiedEmail'=>'[email protected]',
    // this is used in contact page

);

environments/main-prod.php:
The application configuration settings required for the application on production

return array(
            'components' => array(

                'db'=> array(
                    'connectionString' => $params['db.connectionString'],
                    'username' => $params['db.username'],
                    'password' => $params['db.password'],
                    'schemaCachingDuration' => YII_DEBUG ? 0 : 86400000, // 1000 days
                    'enableParamLogging' => YII_DEBUG,
                    'charset' => 'utf8'
                    ),

                'phpThumb'=>array(
                    'class'=>'ext.EPhpThumb.EPhpThumb',
                    'options'=>array(),
                    ),
            ),

            'modules'=>array(

                // Amazon SES
                'ses'=>array(
                    'password'=>'clevertech',
                ),
            )

);

after reading the Wiki many times, it seems it would be very helpful to have example code ( like i am trying to do above ) including the settings needed in the config files ( either local or prod ) to set up a couple of modules and db connection.

tks

runpostdeploy doesn't work on Windows

Hi,

I tried to run runpostdeploy.bat and got this error:
"Could not open input file: E:\xampp\htdocs\yiiboiler\common\lib\postdeploy.php"

Could you please have a check?

Thanks

Issue using an CActiveDataProvider with a non standard Key together with TBRelationalColumn

I think i discovered an issue in the TBRelationalColumn getPrimaryKey method.

When feeding the RBRelationalColumn with a dataProvider where the keyAttribute !== null the widget crashes with a TbRelationalColumn.keyAttribute is not defined error.

I tracked the bug down to the following line
...

        $key = $this->grid->dataProvider->keyAttribute === null ? $data->getPrimaryKey()
            : $data->{$this->keyAttribute};

...

Where you can see the keyAttribute of the $this object is returned instead of the keyAttribute of the dataProvider.

so this
...

        $key = $this->grid->dataProvider->keyAttribute === null ? $data->getPrimaryKey()
            : $data->{$this->grid->dataProvider->keyAttribute};

...

should fix the problem.

Best regards

Inconsistent user table column names

It isn't good idea to mix camelCase (passwordStrategy) and snake_case (login_attempts) across one table and even one database. We should rename it to snake_case and change codebase that using it. Do you agree?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.