GithubHelp home page GithubHelp logo

tonydspaniard / yiinitializr-basic Goto Github PK

View Code? Open in Web Editor NEW
26.0 7.0 16.0 660 KB

Yii Framework project structure boilerplate for basic requirements

PHP 21.32% CSS 55.81% JavaScript 22.74% Shell 0.13%

yiinitializr-basic's Introduction

YIInitializr-basic

The following is a proposed project structure for basic applications that works in conjunction with YIInitializr components.

YIInitializr vanilla projects make extensive use of Composer. We found at 2amigos.us that is easier to your extensions bundle outside of your application scope - thanks to Phundament and Tobias Munk for his knowledge and shares. Composer is your dependency package best friend.

The package is cleaned from extensions, you choose what you wish to include in your composer.json files. The only ones included are Yii Framework (obviously), YiiStrap and YiiWheels, the rest is up to you. We do not want to confuse you

Setup and first run

  • Set up Git by following the instructions here.
  • Update the configurations in app/config/ to suit your needs. The common/config/main.php is configured to use sqllite by default. Change your common/config/env/dev.php to suit your database requirements.
  • Composer is required The package includes already a composer.phar file.
  • Browse through the composer.json and remove the dependencies you don't need also update the required versions of the extensions.
  • If you have composer installed globally:
    • Run composer self-update to make sure you have the latest version of composer.
    • Run composer install to download all the dependencies.
  • If you work the composer.phar library within the project boilerplate.
    • Run php composer.phar self-update to make sure you have the latest version of composer.
    • Run php composer.phar install to download all the dependencies.
  • Yiinitializr\Composer\Callback will configure everything required on your application: runtime and assets folders and migrations.

For more information about using Composer please see its documentation.

###How to configure the application

We focused to release the pain of configuring your application and combine your configuration files. Yiinitializr\Helpers\Initializr is very easy to use, check for example the bootstrap index.php file:

require('./../app/lib/vendor/yiisoft/yii/framework/yii.php');

Yii::setPathOfAlias('Yiinitializr', './../app/lib/Yiinitializr');

use Yiinitializr\Helpers\Initializer;

Initializer::create('./../app', 'main', array('common', 'env', 'local'))->run();

For more information about Yiinitializr please check it at its github repo.

Overall Structure

Bellow the directory structure used:

   |-app
   |---cli
   |-----commands
   |-----migrations
   |---config
   |-----env
   |---controllers
   |---extensions
   |-----behaviors
   |-----components
   |---helpers
   |---lib #it will hold composer 'vendor' folder
   |-----Yiinitializr
   |-------Cli
   |-------Composer
   |-------Helpers
   |-------config
   |---messages
   |---models
   |---modules
   |---views
   |-----layouts
   |-----site
   |---widgets
   |-www
   |---css
   |-----fonts
   |---img
   |---js
   |-----libs

Extensions

The following extensions are part of YIInitializr-basic template:

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

yiinitializr-basic's People

Contributors

akireikin avatar anton44eg avatar borales avatar ifdattic avatar kachar avatar resurtm avatar tonydspaniard avatar ykichanov avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

yiinitializr-basic's Issues

Error on composer install

Getting the following exception when running composer install:

[ErrorException]
ZipArchive::extractTo(app/lib/vendor/composer/af4e51d0/yii-f0fee98ee84f70f1f3652f65562c9670e919cb4e\framework\vendors\htmlpurifier\standalone\HTMLPurifier\ConfigSchema\schema/AutoFormat.RemoveEmpty.RemoveNbsp.Exceptions.txt): failed to open stream: No such file or directory

And setting verbose flag while running the command produced the following stack trace:

Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ZipDownloader.php:75
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 ZipArchive->extractTo() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ZipDownloader.php:75
 Composer\Downloader\ZipDownloader->extract() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/ArchiveDownloader.php:43
 Composer\Downloader\ArchiveDownloader->download() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Downloader/DownloadManager.php:201
 Composer\Downloader\DownloadManager->download() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:155
 Composer\Installer\LibraryInstaller->installCode() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/LibraryInstaller.php:86
 Composer\Installer\LibraryInstaller->install() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:153
 Composer\Installer\InstallationManager->install() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer/InstallationManager.php:14
0
 Composer\Installer\InstallationManager->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:526
 Composer\Installer->doInstall() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:215
 Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/InstallCommand.php:122
 Composer\Command\InstallCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command
/Command.php:241
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/A
pplication.php:892
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Cons
ole/Application.php:191
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.
php:121
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:43
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:15

Yiniitializr not aliased

www/index.php throws an error on first startup because Yiinitializr isn't aliased.

Adding the line:

Yii::setPathOfAlias('Yiinitializr', './../../common/lib/Yiinitializr');

prior to the Initializer call fixes this

Got Error "CDbConnection failed to open the DB connection."

First of all, thanks for your great template which help a lot.

I met some error so reproduce step are:

  1. run command "php composer.phar self-update"
  2. run command "php composer.phar install"
    And after all this, I got this:

D:\OpenServer\domains\basic>php composer.phar install

Yiinitialzr 1.0.1

  • download packages specified in composer.json
  • configures your runtime folders
  • triggers composer callbacks (yiic commands)

Start Installation? [y/n]: y
Loading composer repositories with package information
Installing dependencies

  • Installing yiisoft/yii (1.1.13)
    Loading from cache

Please, enter your environment -ie. "dev | prod | stage": [dev]: dev

Building environment files.
Your environment configuration file has been created on D:\OpenServer\domains\basic\app\lib\Yiinitializr\config/../../../config
.

'D:\OpenServer\domains\basic\app\lib\Yiinitializr\config/../../../config/env.php'
file already exists. No action has been executed.
'D:\OpenServer\domains\basic\app\lib\Yiinitializr\config/../../../config/env.php'
file already exists. No action has been executed.
Environment files creation process finished.

Building runtime 'runtime' folders.
Your runtime folder has been created on D:\OpenServer\domains\basic\app\lib\Yiinitializr\config/../../...
Runtime 'runtime' folders creation process finished.

Building runtime 'assets' folders.
Your assets folder has been created on D:\OpenServer\domains\basic\app\lib\Yiinitializr\config/../../../../www.
Runtime 'assets' folders creation process finished.
Script Yiinitializr\Composer\Callback::postPackageInstall handling the post-package-install event terminated with an exception

[CDbException]
CDbConnection failed to open the DB connection.

Do I miss something?

No matching package found for yiistrap

Hopefully this isn't user error on my part by this is happening with both basic and intermediate so far:

php composer.phar install

Yiinitialzr 1.0.1

  • download packages specified in composer.json
  • configures your runtime folders
  • triggers composer callbacks (yiic commands)

Start Installation? [y/n]: y
Loading composer repositories with package information
Installing dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- 2amigos/yiiwheels dev-master requires crisu83/yiistrap dev-master -> no matching package found.
- 2amigos/yiiwheels dev-master requires crisu83/yiistrap dev-master -> no matching package found.
- Installation request for 2amigos/yiiwheels dev-master -> satisfiable by 2amigos/yiiwheels[dev-master].

Potential causes:

Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Your requirements could not be resolved to an installable set of packages

Problem 1
- 2amigos/yiiwheels dev-master requires 2amigos/yiistrap 1.* -> no matching package found.
- 2amigos/yiiwheels dev-master requires 2amigos/yiistrap 1.* -> no matching package found.
- Installation request for 2amigos/yiiwheels dev-master -> satisfiable by 2amigos/yiiwheels[dev-master].

Potential causes:

error when running php compser.phar install

Problem 1
- 2amigos/yiiwheels dev-master requires 2amigos/yiistrap 1.0.1 -> satisfiable by 2amigos/yiistrap[1.0.1].
- 2amigos/yiiwheels dev-master requires 2amigos/yiistrap 1.0.1 -> satisfiable by 2amigos/yiistrap[1.0.1].
- Can only install one of: 2amigos/yiistrap[dev-master, 1.0.1].
- Installation request for 2amigos/yiistrap dev-master -> satisfiable by 2amigos/yiistrap[dev-master].
- Installation request for 2amigos/yiiwheels dev-master -> satisfiable by 2amigos/yiiwheels[dev-master].

thanks for the great work.

Requirements Conflict

This is what I do on my terminal

21:22:00 rezha@kimiamania:~/htdocs$ git clone https://github.com/tonydspaniard/yiinitializr-basic.git
Cloning into 'yiinitializr-basic'...
remote: Counting objects: 220, done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 220 (delta 89), reused 206 (delta 77)
Receiving objects: 100% (220/220), 484.86 KiB | 440 KiB/s, done.
Resolving deltas: 100% (89/89), done.

At this point I am editing the config file using my text editor

21:31:09 rezha@kimiamania:~/htdocs/yiinitializr-basic$ php composer.phar self-update
Updating to version 1f2d331fd341897c9d54414a76b909beba9e3a59.
    Downloading: 100%

21:31:13 rezha@kimiamania:~/htdocs/yiinitializr-basic$ php composer.phar install

Yiinitialzr 1.0.1

* download packages specified in composer.json
* configures your runtime folders
* triggers composer callbacks (yiic commands)

Start Installation? [y/n]: y
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - 2amigos/yiiwheels dev-master requires 2amigos/yiistrap 1.0.1 -> satisfiable by 2amigos/yiistrap[1.0.1].
    - 2amigos/yiiwheels dev-master requires 2amigos/yiistrap 1.0.1 -> satisfiable by 2amigos/yiistrap[1.0.1].
    - Can only install one of: 2amigos/yiistrap[dev-master, 1.0.1].
    - Installation request for 2amigos/yiistrap dev-master -> satisfiable by 2amigos/yiistrap[dev-master].
    - Installation request for 2amigos/yiiwheels dev-master -> satisfiable by 2amigos/yiiwheels[dev-master].

I delete yiinitializr-basic folder and clone it again for the second time, this time I didn't do anything to the config file, just php composer self-update and php composer.phar install
but the result are same

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.