GithubHelp home page GithubHelp logo

2amigos / yii2-app-template Goto Github PK

View Code? Open in Web Editor NEW
54.0 54.0 20.0 82 KB

Yii 2 Basic Application Template with ConfigKit.

Home Page: https://2amigos.us

License: Other

PHP 96.22% JavaScript 0.02% CSS 2.42% Batchfile 1.35%
2amigos boilerplate php project-template yii2 yii2-application-template

yii2-app-template's People

Contributors

amigo-tabin avatar bahirul avatar flackovic avatar pana1990 avatar schmunk42 avatar tonydspaniard 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  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

yii2-app-template's Issues

Structure models

That's great template!
I've had an idea what if you add extra folders for search models, form models, queries?

Something that will look like that
image

Too many dependencies

i think to remove The following dependencies in composer.json :

"vlucas/phpdotenv": "^2.4",
"league/container": "^2.2",
"symfony/finder": "^3.1",

sidekit/config already has this dependencies in her composer.json file.

isn't it?

Sorry for my english in advanced if you want i can write in spanish in the future issues.

Regards ;)

Installation Error

When I using a command:
php composer.phar create-project --prefer-dist --stability=dev sidekit/yii2-app-basic your-site-name
OR
php composer.phar create-project --prefer-dist --stability=dev sidekit/yii2-app-template your-site-name

I'm getting the error:
[InvalidArgumentException]
Could not find package sidekit/yii2-app-basic with stability dev.

OR
[InvalidArgumentException]
Could not find package sidekit/yii2-app-template with stability dev.

I've never had that problem before and I've been downloading multiple projects via composer before.
What is the problem?

YII_DEBUG and YII_ENV settings not being honoured

It is assumed that YII_DEBUG and YII_ENV constants are defined in .env file as environment variables. However .env settings are not honoured by Yii. Here's why:

In public/index.php we have:

require __DIR__ . '/../bootstrap/autoload.php';
require __DIR__ . '/../bootstrap/sidekit.php';

In bootstrap/autoload.php:

require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';

In vendor/yiisoft/yii2/BaseYii.php (which is an ancestor for vendor/yiisoft/yii2/Yii.php):

defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

and finally in bootstrap/sidekit.php:

defined('YII_DEBUG') or define('YII_DEBUG', ConfigKit::env()->get('YII_DEBUG'));
defined('YII_ENV') or define('YII_ENV', ConfigKit::env()->get('YII_ENV'));

Since YII_DEBUG and YII_ENV have been already defined in BaseYii, these settings have no effect.
It is necessary for bootstrap/sidekit.php to load prior to vendor/yiisoft/yii2/Yii.php.

Missing alias @tests

I'm having some drawbacks with fixtures, if i set alias @tests it fix.

How reproduce issue :

1º create migrate post and run
2º create model of post
3º create fixture of post
4º execute yii fixture Post // this raise exception unfound namespace

[ENH] Add vars in env to mailer config

I think is useful add the following vars in .env :

MAIL_HOST                     = 
MAIL_USERNAME           =  
MAIL_PASSWORD           =  
MAIL_PORT                     = 587
MAIL_ENCRYPTION         = tls

And

'transport' => [
             'class' => 'Swift_SmtpTransport',
             'host' => ConfigKit::env()->get('MAIL_HOST'),
             'username' => ConfigKit::env()->get('MAIL_USERNAME'),
             'password' => ConfigKit::env()->get('MAIL_PASSWORD'),
              'port' => ConfigKit::env()->get('MAIL_PORT'),
              'encryption' => ConfigKit::env()->get('MAIL_ENCRYPTION'),
],

The file or directory to be published does not exist: ../vendor/bower/jquery/dist

On default template installation, alias for bower is missing in test environment.

This results in errors

The file or directory to be published does not exist: path/to/project/vendor/bower/jquery/dist.

Solution is to put same alias that can be found in web conf into test conf.


'aliases' => [
        '@bower' => '@vendor/bower-asset',
    ]

autoload src sugestion name

We load src folder with App, when app it self already defined in yii2.
I think it will be good if we change App to src. It will prevent typo or confusing namespace name.
Also change App/Configuration to app/configuration will be good, use lowercase instead ucfirst folder name for standardization.

manage events

in the documentation of the usuario module there is an example to use an external events.php file, how and where can it be imported into the entry point?
Thank you

Enviroment tests

When i run the following unit test:

<?php

use SideKit\Config\ConfigKit;

class SideKitTest extends \Codeception\Test\Unit
{
    /**
     * @var \UnitTester
     */
    protected $tester;

    // tests
    public function testEnviroment()
    {
        expect(ConfigKit::env()->get('DATABASE_DSN_DB'))->equals('yii2_tests');
    }
}

it fails:

screenshot_1

Skinny models, controllers and views - but fat what?

In your guidelines you tell us to have skinny controllers, lean models and slender views.

Business logic should not be in those.

Understood.

What you haven't done, however, is tell us where to put it. 😄

In components?

Composer scripts

Composer script have 300secs timeout by default, i should indicate it in this line :

Once the commands finish simply do the following:

cd your-site-name 
composer start-server // here 

if you executes composer run start-server --timeout=0 it ignore timeout, further details composer/composer#4918.

Other way we can config yii serve in controllerMap property to set docroot by default.

'controllerMap' => [
     'serve' => [
           'class' => 'yii\console\controllers\ServeController',
           'docroot' => '@web',
      ]
],

// then
yii serve // it wors!

add alias @root

is root alias is defined ?
for now i set manual root alias with this on bootstrap aliases:
Yii::setAlias('@root', ConfigKit::config()->getRootPath());

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.