Giter Club home page Giter Club logo

yii2-app-basic's Introduction

Yii 2 Basic Project Template


Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small projects.

The template contains the basic features including user login/logout and a contact page. It includes all commonly used configurations that would allow you to focus on adding new features to your application.

Latest Stable Version Total Downloads build

DIRECTORY STRUCTURE

  assets/             contains assets definition
  commands/           contains console commands (controllers)
  config/             contains application configurations
  controllers/        contains Web controller classes
  mail/               contains view files for e-mails
  models/             contains model classes
  runtime/            contains files generated during runtime
  tests/              contains various tests for the basic application
  vendor/             contains dependent 3rd-party packages
  views/              contains view files for the Web application
  web/                contains the entry script and Web resources

REQUIREMENTS

The minimum requirement by this project template that your Web server supports PHP 7.4.

INSTALLATION

Install via Composer

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

You can then install this project template using the following command:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

Now you should be able to access the application through the following URL, assuming basic is the directory directly under the Web root.

http://localhost/basic/web/

Install from an Archive File

Extract the archive file downloaded from yiiframework.com to a directory named basic that is directly under the Web root.

Set cookie validation key in config/web.php file to some random secret string:

'request' => [
    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
    'cookieValidationKey' => '<secret random string goes here>',
],

You can then access the application through the following URL:

http://localhost/basic/web/

Install with Docker

Update your vendor packages

docker-compose run --rm php composer update --prefer-dist

Run the installation triggers (creating cookie validation code)

docker-compose run --rm php composer install    

Start the container

docker-compose up -d

You can then access the application through the following URL:

http://127.0.0.1:8000

NOTES:

  • Minimum required Docker engine version 17.04 for development (see Performance tuning for volume mounts)
  • The default configuration uses a host-volume in your home directory .docker-composer for composer caches

CONFIGURATION

Database

Edit the file config/db.php with real data, for example:

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
];

NOTES:

  • Yii won't create the database for you, this has to be done manually before you can access it.
  • Check and edit the other files in the config/ directory to customize your application as required.
  • Refer to the README in the tests directory for information specific to basic application tests.

TESTING

Tests are located in tests directory. They are developed with Codeception PHP Testing Framework. By default, there are 3 test suites:

  • unit
  • functional
  • acceptance

Tests can be executed by running

vendor/bin/codecept run

The command above will execute unit and functional tests. Unit tests are testing the system components, while functional tests are for testing user interaction. Acceptance tests are disabled by default as they require additional setup since they perform testing in real browser.

Running acceptance tests

To execute acceptance tests do the following:

  1. Rename tests/acceptance.suite.yml.example to tests/acceptance.suite.yml to enable suite configuration

  2. Replace codeception/base package in composer.json with codeception/codeception to install full-featured version of Codeception

  3. Update dependencies with Composer

    composer update  
    
  4. Download Selenium Server and launch it:

    java -jar ~/selenium-server-standalone-x.xx.x.jar
    

    In case of using Selenium Server 3.0 with Firefox browser since v48 or Google Chrome since v53 you must download GeckoDriver or ChromeDriver and launch Selenium with it:

    # for Firefox
    java -jar -Dwebdriver.gecko.driver=~/geckodriver ~/selenium-server-standalone-3.xx.x.jar
    
    # for Google Chrome
    java -jar -Dwebdriver.chrome.driver=~/chromedriver ~/selenium-server-standalone-3.xx.x.jar
    

    As an alternative way you can use already configured Docker container with older versions of Selenium and Firefox:

    docker run --net=host selenium/standalone-firefox:2.53.0
    
  5. (Optional) Create yii2basic_test database and update it by applying migrations if you have them.

    tests/bin/yii migrate
    

    The database configuration can be found at config/test_db.php.

  6. Start web server:

    tests/bin/yii serve
    
  7. Now you can run all available tests

    # run all available tests
    vendor/bin/codecept run
    
    # run acceptance tests
    vendor/bin/codecept run acceptance
    
    # run only unit and functional tests
    vendor/bin/codecept run unit,functional
    

Code coverage support

By default, code coverage is disabled in codeception.yml configuration file, you should uncomment needed rows to be able to collect code coverage. You can run your tests and collect coverage with the following command:

#collect coverage for all tests
vendor/bin/codecept run --coverage --coverage-html --coverage-xml

#collect coverage only for unit tests
vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml

#collect coverage for unit and functional tests
vendor/bin/codecept run functional,unit --coverage --coverage-html --coverage-xml

You can see code coverage output under the tests/_output directory.

yii2-app-basic's People

Contributors

arhell avatar cebe avatar creocoder avatar damasco avatar davertmik avatar developedsoftware avatar elisdn avatar githubjeka avatar ha3ik avatar kingyes avatar klimov-paul avatar kolyunya avatar lucianobaraglia avatar maximal avatar mohorev avatar naktibalda avatar pana1990 avatar particleflux avatar qiangxue avatar ragazzo avatar ricpelo avatar rob006 avatar samdark avatar schmunk42 avatar silverfire avatar slavcodev avatar sohelahmed7 avatar terabytesoftw avatar toir427 avatar wintersilence 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  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

yii2-app-basic's Issues

Port in external redirect in Codeception Acceptance Test

What steps will reproduce the problem?

On a new basic yii2 project, create a controller and action which return redirect response to external domain.
For example:

class FooController extends Controller {
    public function actionRedirect() {
        return $this->redirect('http://google.com');
    }
}

Next create an acceptance test opening the action url with amOnPage method.
For example:

$i = new AcceptanceTester($scenario);
$i->amOnPage('index-test.php?r=foo/redirect');

Then run php yii serve and run the acceptance test codecept run acceptance.

What's expected?

It should be redirected to http://google.com, not http://google.com:8080. I think the 8080 port comes from test_entry_url on codeception.yml or PhpBrowser.url on acceptance.suite.yml. When i change both of them to 80 and run php yii serve on port 80, it redirects to http://google.com.

What do you get instead?

[GuzzleHttp\Exception\ConnectException] cURL error 7: Failed to connect to google.com port 8080: Timed out

Additional info

Q A
Yii vesion >=2.0.5
PHP version PHP 7.0.4 from Xampp 3.2.2
Operating system Windows 10

Running codeception from root with -c option, throws exception

By following currently the only guide for codeception in yii2 I successfully ran the tests with command c:\my\project\location\tests>codecept run without errors.

But then, I was looking forward to creating a command in IDE I'm using (PhpStorm 8) to run those tests with shortcut and get an output within IDE.

As IDE rans commands relative to application root, I tried to test it from cmd.exe. I ran command similar to this: c:\my\project\location>codecept -c c:\my\project\location\tests (-c option to command codeception to use codeception.yml that resides in \tests dir) and got an error:

  [InvalidArgumentException]
  There are no commands defined in the "M" namespace.

Should I run a codecept command from application root in a different way?

I'm running yii2 app on Win7 station through wamp25 package that has php v5.5.x.

Add .env file support

Moved from yiisoft/yii2#13602

Original text:
I suggest to add .env support, like it's done in Laravel. With it it's much easier to make a basic
config of the app/switching between environments, etc.

new line within double quotes.

I want the users to import csv files. But if it contains new line within double quotes, it throws undefined offset error. I tried preg_replace to replace new line within double quotes using regular expression. But it still shows same error. Is there any other way to solve this problem.

Some improvements on the default tests

When you run the default tests, you need these two entries under require-dev in composer.json:

"codeception/specify": "*",
"codeception/verify": "*"

When you then run the default tests, you get this deprecated error:

Test  codeception/unit/models/ContactFormTest.php:testContact
[PHPUnit_Framework_Warning] PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

Use https link to clone dependencies instead of ssh link by default.

If I don't want to create a token nor use an ssh key, the dependencies should be able to download using https links by default. Currently jquery dependency point to [email protected]:jquery/jquery-dist.git by default and there's no file to modify and to use https instead for dependencies.

What steps will reproduce the problem?

  1. DON'T HAVE A COMPOSER TOKEN
git clone https://github.com/yiisoft/yii2-app-basic.git
cd yii2-app-basic
php composer.phar global require "fxp/composer-asset-plugin:^1.2.0"
php composer.phar create-project --prefer-dist --no-interaction --stability=dev yiisoft/yii2-app-basic basic

What's expected?

  1. To download without problems every dependence.
  2. Have a basic yii app ready to run.

What do you get instead?

Installing yiisoft/yii2-app-basic (dev-master b3e97d79406ae1b74dc66acbbf76d516fb8d81a2)
  - Installing yiisoft/yii2-app-basic (dev-master master) Loading from cache
Created project in basic
Loading composer repositories with package information
Updating dependencies (including require-dev)
Failed to clone the [email protected]:jquery/jquery-dist.git repository, try running in interactive mode so that you can enter your GitHub credentials

                                                                                                                                                              
  [RuntimeException]                                                                                                                                          
  Failed to execute git clone --mirror '[email protected]:jquery/jquery-dist.git' '/home/tinkerware/.composer/cache/vcs/git-github.com-jquery-jquery-dist.git/'  
                                                                                                                                                              

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [--] [<package>] [<directory>] [<version>]

Additional info

This happens due to a dependency pointing to an ssh direction ([email protected]:jquery/jquery-dist.git).

There should be a file to update this route to use https and/or place the https link by default (https://github.com/jquery/jquery-dist.git) for the cases when we don't want to use keys nor token.

Q A
Yii version 2
PHP version PHP 5.6.29-0+deb8u1
Operating system Debian 8 - Jessie

Unit test parent class (dev)

What steps will reproduce the problem?

Create class TestCase extends yii\codeception\DbTestCase in ./tests/unit with namespace tests\unit

Extend any test class from ./tests/unit/models

namespace tests\models;
import tests\unit\TestCase;
class LoginFormTest extends TestCase

Add (or not) in ./tests/_bootstrap.php

Yii::setAlias('@tests', dirname(__DIR__));

Run unit tests

What's expected?

PHP Fatal error: Class 'tests\unit\TestCase' not found in [TestClass.php] on line ...
I tryed namespase app\tests\unit instead tests\unit also.

What do you get instead?

Runned tests.

Additional info

Q A
Yii vesion 2.0.9
PHP version 5.6.23
Operating system Windows 10 x64

cookieValidationKey is not generated after installation

What steps will reproduce the problem?

composer install

What's expected?

Security code is generated and inserted in web.php

What do you get instead?

I had to put it manually.

Additional info

PHP version: 7.0.4
Composer version 1.2-dev (08ef916beded8c738be11acc4f463c450e277d64) 2016-06-06 10:22:06

Php modules

[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mongodb
openssl
pcntl
pcre
PDO
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib

[Zend Modules]
Xdebug
Zend OPcache

Unable to run basic Yii2 app

I'm following the official Yii install guide

composer global require "fxp/composer-asset-plugin:~1.1.0"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic

After the installation I have try to access the installed application and and there was an error:

Invalid Parameter – yii\base\InvalidParamException

The file or directory to be published does not exist: D:\xampp\htdocs\basic\vendor\bower/jquery/dist

When I changed the @bower alias with
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower');
to
Yii::setAlias('@bower', $this->_vendorPath . DIRECTORY_SEPARATOR . 'bower/bower-asset ');
everything was OK.

Problem with @tests alias in Codeception config file after console command

@tests alias in codeception/config/config.php seems not to be working correctly if it loads after main console config file. And this is excatly the way how it loads when you try to start console commands from codeception/bin folder.

$config = yii\helpers\ArrayHelper::merge(
    require(YII_APP_BASE_PATH . '/config/console.php'),
    require(__DIR__ . '/../config/config.php')
);

It's happening because of @app/config/console.php config file, because of this code
Yii::setAlias('@tests', dirname(__DIR__) . '/tests/codeception');

After console command, in codeception/config/config.php file @tests alias value is 'ProjectFolder/tests/codeception', but after that there are lines trying to add additional 'codeception' folder

    'controllerMap' => [
        'fixture' => [
            'class' => 'yii\faker\FixtureController',
            'fixtureDataPath' => '@tests/codeception/fixtures',
            'templatePath' => '@tests/codeception/templates',
            'namespace' => 'tests\codeception\fixtures',
        ],
    ],

So if you're trying generate a fixture for example, the path is not working correctly.

Logout btn is not in line with the rest of the menu

This issue has originally been reported by @Morpheus-ro at yiisoft/yii2#11161.
Moved here by @SilverFire.


When I installed Yii2 with composer"

composer create-project yiisoft/yii2-app-basic basic 2.0.7

and I'm viewing the page
http://localhost/web/site/login and enter admin/admin
the next page, the redirected page (home), has the logout not in line with the others links from the menu.

Q A
Yii version 2.0.7
PHP version 5.5.9
Operating system Ubuntu 14.04

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

What steps will reproduce the problem?

$ composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic ./mynewproject

What's expected?

A basic app.

What do you get instead?


Installing yiisoft/yii2-app-basic (2.0.10)
  - Installing yiisoft/yii2-app-basic (2.0.10)
    Downloading: 100%

Created project in ./mynewproject
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2 2.0.9 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.8 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.7 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.10 requires bower-asset/jquery 2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 ~2.0.5 -> satisfiable by yiisoft/yii2[2.0.10, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9].

Additional info

Q A
Yii version ??
PHP version 5.5.9
Operating system Ubuntu 14.4 LTS

Tried removing "--stability=dev", same result.

composer create-project sucess,BUT can not run web app

env:

Composer version 1.0-dev (c9501a4cc164b176de48e44b239e619cfd5f14e5) 2015-12-16 18:51:41
fxp/composer-asset-plugin (v1.0.3)

run:

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

visit in browser, show this exception:

Invalid Parameter – yii\base\InvalidParamException

The file or directory to be published does not exist: /Users/tomjamescn/my_develop_space/php_workspace/test/basic/vendor/bower/jquery/dist

in the dir ./vender/bower has this subdirs:
bower-asset

jquery dir is under bower-asset dir.

One month ago, there is no problem~

Running of functional tests creates directory @webroot with garbage.

What steps will reproduce the problem?

composer exec codecept run functional

What's expected?

Tests pass.

What do you get instead?

Tests pass, but directory @webroot/assets was created, it contains JS, CSS etc., these files are not gitignored.

Additional info

Q A
Yii vesion 2.0.9
PHP version PHP 5.5.9-1ubuntu4.17
Operating system Linux

Probably reason of this lies here https://github.com/Codeception/Codeception/blob/0e268a10e2e5c7d640a70ddf7dc7d558f2d3b0c1/src/Codeception/Lib/Connector/Yii2.php#L253:L256. I guess need to stub AssetManager in such way to prevent real publishing of assets or use real AssetManager and publish files correctly.

Unit ContactFormTest.php Doesn't Work

What steps will reproduce the problem?

codecept run

What's expected?

test will pass

What do you get instead?

The email files generated begin with a datestamp and then .eml extension. testing_message.eml never exists. Test always fails.

private function getMessageFile()
{
    return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml';
}

Additional info

Q A
Yii vesion
PHP version
Operating system

Disable db profiler in Yii 2.0

Hi All,

I am trying to disable the db profiler on my production systems and I constantly get the below profiling information on my logs:

2015-06-25 10:13:54 [172.17.42.1][-][-][info][yii\db\Connection::open] Opening DB connection: mysql:host=172.18.64.142;dbname=live
2015-06-25 10:13:54 [172.17.42.1][-][-][profile begin][yii\db\Connection::open] Opening DB connection: mysql:host=172.18.64.142;dbname=live
2015-06-25 10:13:54 [172.17.42.1][-][-][profile end][yii\db\Connection::open] Opening DB connection: mysql:host=172.18.64.142;dbname=live
2015-06-25 10:13:54 [172.17.42.1][-][-][info][yii\db\Command::query] SELECT * FROM metrics_micro WHERE metrics_id='3'
2015-06-25 10:13:54 [172.17.42.1][-][-][profile begin][yii\db\Command::query] SELECT * FROM metrics_micro WHERE metrics_id='3'
2015-06-25 10:13:54 [172.17.42.1][-][-][profile end][yii\db\Command::query] SELECT * FROM metrics_micro WHERE metrics_id='3'

My logs are :

   'log' => [
   'traceLevel' => YII_DEBUG ? 3 : 0,
   'targets' => [
   [
   'class' => 'yii\log\FileTarget',
   'logFile' => '@logs/app.log',
   'logVars' => [],
   ],
   [
   'class' => 'yii\log\FileTarget',
      'logFile' => Yii::getAlias('@logs').'/cron.log',
      'logVars' => [],
      'categories' => ['cronjobs']
    ],
  ],
],

Even if I set YII_DEBUG to FALSE the profiling information still appears.

Is there a way to disable the db profiling?

-S.

Unable to install basic Yii2 app

I'm following the official Yii install guide, but composer fails to install dependencies:

$ composer -vvv create-project --prefer-dist yiisoft/yii2-app-basic basic
Downloading https://packagist.org/packages.json
Writing /home/dk/.composer/cache/repo/https---packagist.org/packages.json into cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2015-01.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2015-04.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2015-07.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-latest.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-app-basic.json from cache
Installing yiisoft/yii2-app-basic (2.0.6)
  - Installing yiisoft/yii2-app-basic (2.0.6)
Reading /home/dk/.composer/cache/files/yiisoft/yii2-app-basic/3159d797b754d99c5d8adf8a492ba7522b467ddd.zip from cache
    Loading from cache
    Extracting archive
Executing command (CWD): unzip 'basic//fb7e30be9dc714613d08a6df78ebac2f' -d '/home/dk/Tmp/vendor/composer/95f46cae' && chmod -R u+w '/home/dk/Tmp/vendor/composer/95f46cae'

Created project in basic
Reading ./composer.json
Loading config file ./composer.json
Failed to initialize global composer: Composer could not find the config file: /home/dk/.composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Loading composer repositories with package information
Downloading https://packagist.org/packages.json
Writing /home/dk/.composer/cache/repo/https---packagist.org/packages.json into cache
Installing dependencies (including require-dev)
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2013.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2014.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2015-01.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2015-04.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-2015-07.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-archived.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/p-provider-latest.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-app-basic.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-bootstrap.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-swiftmailer.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-composer.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-ezyang$htmlpurifier.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-cebe$markdown.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-bower-asset$jquery.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-bower-asset$jquery.inputmask.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-bower-asset$punycode.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-bower-asset$yii2-pjax.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-bower-asset$bootstrap.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-swiftmailer$swiftmailer.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-codeception.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-debug.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-gii.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-phpspec$php-diff.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-faker.json from cache
Reading /home/dk/.composer/cache/repo/https---packagist.org/provider-fzaninotto$faker.json from cache
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found.
    - Installation request for yiisoft/yii2 >=2.0.5 -> satisfiable by yiisoft/yii2[2.0.5, 2.0.6].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder()

What steps will reproduce the problem?

codecept run

What's expected?

the test will work

What do you get instead?

PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder()

Additional info

In tests/unit/contactformtest...
public function testContact()
{
$model = $this->getMock('app\models\ContactForm', ['validate']);
$model->expects($this->once())->method('validate')->will($this->returnValue(true));

replacing with createMock seems to fix it

Q A
Yii vesion
PHP version
Operating system

New installation doesn't work on php 5.6

What steps will reproduce the problem?

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

What's expected?

Standart basic application homepage.

What do you get instead?

Parse error: syntax error, unexpected '?' in .../basic/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 822

It works when I manually revert phpunit to 5.7.19. Maybe it's bug in phpunit and should I submit it there?

Additional info

Q A
Yii vesion 2.0.11
PHP version 5.6.13
Operating system Gentoo

the fxp/composer-asset-plugin keeps haunting ...

@samdark ### What steps will reproduce the problem?
trying to push to heroku master..
tried everything like
php composer.phar global update fxp/composer-asset-plugin --no-plugins

tried changing the require section of composer.json..
heroku rejects the push due to fxp/composer-asset-plugin......
kindly help.

How to remove web folder from url

I installed latest basic version of Yii2.0 ,i want to remove web folder from my url .. but when i tried to do this ..my yii is not working properly

Bower-asset path incorrect

I created a new app using the yii2-app-basic template using the following command.

composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic

However when I visit the new app in web browser, I get the error message

Invalid Parameter – yii\base\InvalidParamException

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

The directory structure of the app vendor dir follows

vendor
    bower
        bower-asset
            jquery
                dist

The composer.json

{
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": ">=2.0.5",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
        "process-timeout": 1800
    },
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0777",
                    "web/assets": "0777",
                    "yii": "0755"
                }
            ],
            "generateCookieValidationKey": [
                "config/web.php"
            ]
        },
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
}

Link structure duplicates with index.php

What steps will reproduce the problem?

Install yii. Create htaccess like the one in manual.
In UrlManager: 'enablePrettyUrl' => true, 'showScriptName' => false, 'enableStrictParsing' => false,
Then open http://yourdomain.com/index.php or any page http://yourdomain.com/index.php/any-page

What's expected?

I guess, to redirect to pages without index.php or throw 404 exception. That's up to debate.

What do you get instead?

It works and creates page duplicates.

Additional info

Lastest yii 2.0.11, php 5.6, apache. Same with nginx and default config.

The Damn fxp/composer-asset-plugin weird problem is back!

What steps will reproduce the problem?

  1. I cloned a forked version of official yii2-app-basic in my local machine.
  2. update composer asset plugin to 1.1.3
  3. git push origin master.
  4. my app is connected to heroku through github ( automatically deployed when i push to github).

What's expected?

While it should work as it works locally,

What do you get instead?

I get '/app/vendor/bower/jquery/dist' can't publish to the directory error.

Additional info

Q A
Yii vesion
PHP version
Operating system

Query Builder: join doesn't passes parameters

$query = $query->leftJoin('DESIGNATIONS AS DESIGNATIONS2', [
                    'DESIGNATIONS2.DES_ID' => 'ART_DES_ID',
                    'AND DESIGNATIONS2.DES_LNG_ID' => ':langId'
                ],
                [':langId' => 16]
            );

What's expected?

LEFT JOINDESIGNATIONS DESIGNATIONS2 ON (DESIGNATIONS2.DES_ID='ART_DES_ID') AND (AND DESIGNATIONS2.DES_LNG_ID=16)

What do you get instead?

LEFT JOINDESIGNATIONS DESIGNATIONS2 ON (DESIGNATIONS2.DES_ID='ART_DES_ID') AND (AND DESIGNATIONS2.DES_LNG_ID=':langId')

retrieve user identity in token based auth.

in api app.
I config user component with enableSession=false, and use HttpBearerAuth solution。How to retrieve user identity, Yii::$app->user->identity return false, any idea for this solution to retrieve user identity?

rest api Not Found

What steps will reproduce the problem?

I try to create some rest APIs for my app follow the tutorial
http://www.yiiframework.com/doc-2.0/guide-rest-quick-start.html

step 1:create a new project based on the basic template by composer
step 2:Creating a Controller
step 3:Configuring URL Rules
step 4:Enabling JSON Input
step 5:Trying it Out

What's expected?

not found
image

What do you get instead?

Additional info

could you provide an example project (or a rest api template)?

Q A
Yii vesion 2.0.7
PHP version 7.0.3
Operating system centos 7 x64

Yii2-faker fixture Error

Yii2 faker extension generate the folowing error

Error: The template path "@tests/unit/templates/fixtures" does not exist"

the console.php configuration:

<?php

Yii::setAlias('@tests', dirname(__DIR__) . '/tests');

$params = require(__DIR__ . '/params.php');
$db = require(__DIR__ . '/db.php');

return [
    'id' => 'basic-console',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log', 'gii'],
    'controllerNamespace' => 'app\commands',
    'controllerMap' => [
    'fixture' => [
            'class' => 'yii\faker\FixtureController'
        ],
    ],
    'modules' => [
        'gii' => 'yii\gii\Module',
    ],
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'log' => [
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db' => $db,
    ],
    'params' => $params,
];

Missing @webroot alias value in functional tests

What steps will reproduce the problem?

Run functional tests:

composer exec codecept run functional

What's expected?

controllers
models
web
└── assets
    ├── 4e4966d0
    ├── 562e9843
    ├── cfeea075
    └── .gitignore

What do you get instead?

@webroot
└── assets
    ├── 4e4966d0
    ├── 562e9843
    └── cfeea075
controllers
models
web
└── assets
    └── .gitignore

Additional info

Q A
Yii vesion dev-master
PHP version 5.5.9
Operating system Ubuntu

Include composer.lock (at least in releases)

What steps will reproduce the problem?

Install (create-project) an old version of this app.

What's expected?

Always a working app with locked extensions.

What do you get instead?

Currently composer runs an update which will resolve the extension constraints to their latest version, which might be an untested combination.

Additional info

Q A
Yii vesion any
PHP version any
Operating system any

Committing this file to VC is important because it will cause anyone who sets up the project to use the exact same versions of the dependencies that you are using. Your CI server, production machines, other developers in your team, everything and everyone runs on the same dependencies, which mitigates the potential for bugs affecting only some parts of the deployments. Even if you develop alone, in six months when reinstalling the project you can feel confident the dependencies installed are still working even if your dependencies released many new versions since then. (See note below about using the update command.)

References:

CC: @mikehaertl

Yii2 rest with oracle

Hi, when I'm trying select some data from db, it throws me an error, 'Undefined index: CONSTRAINT_TYPE'. What's the problem? help me please

Variables in the global scope.

😦

<?= $GLOBALS['params']['adminEmail']; ?> // [email protected]

$config from index.php and param from web.php are stored in the global scope throughout the life of the application. No sense.

image

Propose:

(new yii\web\Application(require __DIR__ . '/../config/web.php'))->run();
'params' => require __DIR__ . '/params.php',

Do you have any plans to implement/integrate environments mechnism in basic app just like one in the advance app?

I want to know that if yii2 team is working or planning to work on the environment mechanism in the yii2 basic application just like one exist in the advance application. I have usually seen people using yii2 basic application for REST APIs. While deployment they face issues like params mis-match etc. So I think we should handle the environment in basic application the same way we handle it in the advance application. If you people are not working on it, do let me know I will create a merge request.

Thanks,

ContactCept functional & acceptance typo

This is a copy of the same issue that was fixed in the advanced app yesterday.

There's a typo in both files:
acceptance/ContactCept line 38
functional/ContactCept line 32

$I->expectTo('see that email adress is wrong');
should be
$I->expectTo('see that email address is wrong');

Working on pull request.

Unable to install Yii2 application

HI All,

I am new for the Yii2.
I follow the instruction given in the installment process but unable to execute it.
Can anybody explain how can i install it on my local system?

Thanks in advance.

composer exec codecept run return nothing after a fresh install

What steps will reproduce the problem?

Install basic template as described in the README.md and set real db parameters in config/db.php
Execute: composer exec codecept run

What's expected?

Something; failure, error, warning

What do you get instead?

Nothing

Additional info

Q A
Yii vesion 2.0.11-dev
PHP version 7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )
Operating system Ubuntu 16.04

Can't run migration without foreign key error

What steps will reproduce the problem?

codeception/bin/yii migrate
Yii Migration Tool (based on Yii v2.0.8)

Creating migration history table "migration"...Done.
Total 7 new migrations to be applied:
m141201_013120_create_status_table
m150128_003709_extend_status_table_for_created_by
m150128_233458_extend_status_table_for_slugs
m150209_200619_extend_status_table_for_updated_by
m150209_204852_create_status_log_table
m150219_235923_create_sample_table
m160316_201654_extend_status_table_for_image

Apply the above migrations? (yes|no) [no]:yes
*** applying m141201_013120_create_status_table
> create table {{%status}} ... done (time: 0.006s)
*** applied m141201_013120_create_status_table (time: 0.023s)

*** applying m150128_003709_extend_status_table_for_created_by
> add column created_by integer NOT NULL to table {{%status}} ... done (time: 0.008s)
> add foreign key fk_status_created_by: {{%status}} (created_by) references {{%user}} (id) ...Exception 'yii\db\Exception' with message 'SQLSTATE[HY000]: General error: 1005 Can't create table 'yii2_basic_tests.#sql-98f_22' (errno: 150)
The SQL being executed was: ALTER TABLE status ADD CONSTRAINT fk_status_created_by FOREIGN KEY (created_by) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE'

What's expected?

Completed migration

What do you get instead?

error above

Additional info

Adding foreign keys for the test fails.

I did a composer self-update and composer-update before re-testing. The db permissions do work, status table is created okay.

Also codeception is installed properly.

Q A
Yii vesion
PHP version
Operating system

Checkbox template not working in login view

The template that's used in the login view for the "remember Me" checkbox is not applied when the result gets rendered.

I think the problem is that the template is specified for the field rather than the actual checkbox.

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.