Yii 1.1: yiinitializr

Maximum acceleration for your Yii project start!
32 followers

Introduction

The history... we remember the days when we thought that YiiBoilerplate was a good fit for any project. They were good days, but we were being naive.

Every project has different needs, and it’s those needs that set the requirements. Also, lets be realistic, if you were to develop a project where only the frontend UI with a small admin section was needed, YiiBoilerplate was overkill. In the end, people had to remove unneeded folders, the configuration was unnecessarily complex, a lot of people were not certain where to place the components and there were many other issues.

At 2amigOS! we were slamming our heads down on our keyboards trying to figure out what was the best way to provide a project boilerplate that could fit everyones needs. We soon realized and agreed that composer was the best way to go as a dependency manager (special shout-out thanks to Mr Tobias Schmunk, the guy behind Phundament for his great work and ideas), but we did not want to provide a fixed structure nor a set of extensions, again. Otherwise, we would just be putting a fresh coat of paint on the same problems. We wanted to give the power back to the developer to pick and choose based on their own needs. You know your project the most, so you should be able to set your own desired folder structure. You should be able to select which extensions you want to have pre-installed. And that, my amigos, is how Yiinitializr was born!

Yiinitializr is technically still in beta (?). Why? Because we believe that we need your feedback, yes you, from the Yii community, to make Yiinitializr right for all of us. You’re going to be using it, often (c’mon, you know you will...), so why not have a say in whether it’s enough or not... in what else it should or should not provide.

Okay, okay.. enough talk... now, let’s see how this baby works!

Yiinitializr is extremely easy to use. It is composed of only one page that will ask you three simple things:

  1. What template type do you want to use? Basic, Intermediate or Advanced
  2. Which extensions do you want pre-installed? Just search and select... really.. that’s all... no kidding... cool, huh?
  3. Okay... maybe we misspoke... it’s really 3 steps; not questions. Download your finished project boilerplate!
  4. What? Step 4? Maybe we can’t count, but you need to know what to do with the file you just downloaded, right? Well, here’s what you need to do:

Unzip, wherever you want your project to be, then (no, we are not going to tell you how to setup your database configuration. This is just a gentle reminder that you need to do that next...). Ahem... make your database configurations. Now, run the following commands inside the unzipped project’s root:

// make sure you have the latest version of composer
php composer.phar self-update 
// run install
php composer.phar install

Now, relax and love it! (or hate us, but keep it to yourself... really, all that negativity focused on us? We’re amigos! Come and share in the enchiladas... click on the docs below the templates to go to that github place and vent there...)

So, now you’re saying, “yeah, man... that is simple, but what are the template differences?”. We thought you’d never ask:

  • Basic: The small in scope project. Is your project just a frontend, or maybe a frontend with an admin interface? Well, this is the basic one, and it contains only /app and /www. Yes, you can still choose the extensions you want.
  • Intermediate: Your needs are maybe a little more complex than the basic offers, but you don’t want to go crazy. This one is closest to the structure you might be familiar with from YiiBoilerplate, but it’s much much lighter.
  • Intermediate has a good solid structure. It contains: /backend, /common, /console and /frontend, and this structure will work for most of your robust applications. Need more?
  • Advanced: Now you’re talking! The advanced structure adds on the /api directory for your web services. Need we say more? Got ideas of world domination? It starts here! ;)

“But I want more details!” Yes, we agree, and this a great point to start the share of some knowledge. We know that once you download any of the template boilerplates you’ll start wondering what’s going on here. What the heck is this way of initializing applications? Check out the yiic.php or the index.php scripts within any of the application’s folder. See what we are doing. There is another surprise extension within, the Yiinitializr components. A set of classes that makes for a really easy way you can configure and install a project.

More documentation and discussion will be coming... we promise. We just wanted to let you play and react a little, first.

References

Change Log

  • 15/04/2013 Fixed typo bug and improved initializing
  • 11/04/2013 Initial Release

2amigOS!
web development has never been so fun
www.2amigos.us

Total 19 comments

#16732 report it
DryKillLogic at 2014/03/23 10:51am
virtualhost nginx

Thanks for your quick answer antonio. Yes, I tried everything. I've make it work but just with the standard structure.

This is what I want to acomplish (of course, using path uris):

/ => /frontend/www

/admin => /backend/www

It's working but just with static content. Do you have some configuration example to share with us?. I googled a lot, tried several configurations, tweaks and I hadn't lucky (alias, root inside location block, php block inside location, hardcoded $document_root, so on). It's making me crazy

Thank you.

#16729 report it
Antonio Ramirez at 2014/03/23 03:54am
@Xavier John

did you run composer update to have the Yii library installed?

#16728 report it
Antonio Ramirez at 2014/03/23 03:51am
@DryKillLogic

Have you followed: http://www.yiiframework.com/doc/guide/1.1/en/quickstart.apache-nginx-config

#16726 report it
DryKillLogic at 2014/03/22 09:12pm
Config example for nginx

I'm working on a intermediate setup and I need an example for nginx. I can't make it work. Thanks.

#14790 report it
Xavier John at 2013/09/10 02:43am
Basic - Testing

There is no test folder for the basic template.

I created a folder called 'tests' under app folder and then copied all my test cases plus files generated by yiic, like bootstrap.php, phpunit.xml and WebTestCase.php. Running the testcase fails with error. Class 'CTestCase' not found

My test file is

<?php
 
class DbTest extends CTestCase {
 
    public function testConnection() {
        $this->assertNotNull(Yii::app()->db->connectionString);
    }
 
}
#13825 report it
VaZia at 2013/06/28 01:26pm
Awasome

Great work! But documentation is needed.

#13819 report it
bossm4 at 2013/06/28 05:01am
Thanks and one question

Hi there!

First of all I want to thank you guys for your strong work on this extension. I am looking forward to use it as my core for new applications but I have one question...

What should be the .htaccess file configuration recommend to work this way? (intermediate template)

http://www.mydomain.com/ => /frontend/www

http://www.mydomain.com/admin => /backend/www

I think the best way is point DocumentRoot to /frontend/www and create an Alias for /admin but I am not sure if this configuration could make Yiinitializr work bad or not in proper way.

Maybe is possible to configure that in the template???

I am not an expert on server configuration so any help would be appreciated!!!

Thank you again guys! Good work!

#13737 report it
Antonio Ramirez at 2013/06/20 01:20pm
@ramasurf

I am sorry to hear that, we are currently using the advanced template with Yiinitializr in big projects and we had no issues at all.

It is true, that gii isn't supported, in fact, we are not even using the automation tool for developing CRUD. We just use it for Models (at most) without relations (as it tends to write too much 'assumptions' that are not always correct)

Thank you very much for your support anyway!

#13174 report it
ramasurf at 2013/05/10 01:54pm
Problemas

Hi 2amigos It seems that you did a nice work with Yiinitializr. But trying to install it and develop a simple app, took me a lot of time. When I tried to use the NavBar, I realized that it wasn't the same extension. When I generated code from the DB, Gii didn't support EController and EActiveRecord(details are everything).

I founded my own company as you. I teach Yii at the University and I was excited to use Yiiinitilizr in our projects and classes. But it will be too expensive and risky.

I'll be testing yiinitializr and sharing it here in my city. Thanks for share your work . Atte Sergio

#13167 report it
Antonio Ramirez at 2013/05/10 05:26am
@ramasurf

Apologies,

Yiistrap project has been updated and I need to reconfigure the composer.json file from all templates. Will be done asap.

Sorry again

Edit: Templates updated!

#13164 report it
ramasurf at 2013/05/10 03:13am
error

Hi! thanks for the extension, I want to use it. But I get an error msg from console when I try to install it.

Problem 1

-2amigos/yiiwheels dev-master requires crisu83/yiistrap dev-master -> no matching package found

I did install composer, I've tried with Phundament zip and everything was great. What did I miss? did I do something wrong?

thanks !

#12942 report it
Antonio Ramirez at 2013/04/22 07:16am
@darkheir

Please, check the following answer: https://github.com/2amigos/yiiwheels/issues/6#issuecomment-15253973

#12941 report it
darkheir at 2013/04/22 05:28am
Great project

This seems to be a great project!

In YiiBoilerplate YiiBooster was included but here there is YiiStrap and YiiWheels. There is not much information about both of these plugins so my question is: What is the difference between those plugins and YiiBooster?

#12842 report it
Riyas at 2013/04/15 01:22pm
Great work

Great work..waiting for wiki..

#12823 report it
minkbear at 2013/04/14 03:39am
Thanks

Thanks for your amazing tool. Waiting for document. :D

#12820 report it
Joe.B at 2013/04/13 12:28pm
Great tool

Thank you '2Amigos' for taking your time to make this wonderful tool. You guys are awesome.

#12818 report it
Antonio Ramirez at 2013/04/13 10:26am
@all

Big pleasure, and I am happy it can be useful for you guys. Will write a wiki on how you can use the tools within (Yiinitializr) to create custom ones!

#12814 report it
Nur Rochim at 2013/04/13 08:54am
Great

Wow... i like this 2amigOS! thanks...

#12812 report it
Raoul at 2013/04/13 05:58am
thanks !

Thank for this great tool (again) ;)

Leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet