Giter VIP home page Giter VIP logo

yii2-start's Introduction

Yii2-start

DEMO:

Frontend: http://yii2-start.find-freelancer.pro
Backend: http://yii2-start.find-freelancer.pro/backend/

Authentication:
Login: admin
Password: admin12345

Installation and getting started:

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

If you do not have Composer-Asset-Plugin installed, you may install it by running command: php composer.phar global require "fxp/composer-asset-plugin:1.0.0"

  1. Run the following commands to install Yii2-Start: php composer.phar create-project --prefer-dist --stability=dev vova07/yii2-start yii2-start
    During the installation process can be required password and\or username from your Github account. This is because you make too much request to Github service. Just remember that this can be.
  2. Run command: cd /my/path/to/yii2-start/ and go to main application directory.
  3. Run command: php requirements.php and check the requirements.
  4. Run command: php init to initialize the application with a specific environment.
  5. Create a new database and adjust it configuration in common/config/db.php accordingly.
  6. Apply migrations with console commands:
    • php yii migrate --migrationPath=@vova07/users/migrations
    • php yii migrate --migrationPath=@vova07/blogs/migrations
    • php yii migrate --migrationPath=@vova07/comments/migrations
    • This will create tables needed for the application to work.
    • You also can use database dump db.sql from my/path/to/yii2-start/common/data, but however I recommend to use migrations.
  7. Run modules RBAC commands:
    • php yii rbac/rbac/init
    • php yii users/rbac/add
    • php yii blogs/rbac/add
    • php yii comments/rbac/add
  8. Set document roots of your Web server:

For Apache:

<VirtualHost *:80>
    ServerName www.yii2-start.domain # You need to change it to your own domain  
    ServerAlias yii2-start.domain # You need to change it to your own domain  
    DocumentRoot /my/path/to/yii2-start # You need to change it to your own path  
    <Directory /my/path/to/yii2-start> # You need to change it to your own path  
  	  AllowOverride All  
    </Directory>  
</VirtualHost>
  • Use the URL http://yii2-start.domain to access application frontend.
  • Use the URL http://yii2-start.domain/backend/ to access application backend.

For Nginx:

___Frontend___

``` 
server {
    charset utf-8;
    client_max_body_size 128M;

    listen 80; ## listen for ipv4
    # listen [::]:80 ipv6only=on; ## listen for ipv6

    set $yii2StartRoot '/my/path/to/yii2-start'; ## You need to change it to your own path

    server_name yii2-start.domain; ## You need to change it to your own domain
    root $yii2StartRoot/frontend/web;
    index index.php;

    #access_log  $yii2StartRoot/log/frontend/access.log;
    #error_log   $yii2StartRoot/log/frontend/error.log;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php?$args;
    }

    location /statics {
        alias $yii2StartRoot/statics/web/;
    }

    # uncomment to avoid processing of calls to non-existing static files by Yii
    #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    #    try_files $uri =404;
    #}
    #error_page 404 /404.html;

    location ~ \.php$ {
        #include fastcgi_params;
        include fastcgi.conf;
        fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
    }

    location ~ /\.(ht|svn|git) {
        deny all;
    }
}
```

__Backend__

```
server {
    charset utf-8;
    client_max_body_size 128M;

    listen 80; ## listen for ipv4
    # listen [::]:80 ipv6only=on; ## listen for ipv6

    set $yii2StartRoot '/my/path/to/yii2-start'; ## You need to change it to your own path
    
    server_name backend.yii2-start.domain; ## You need to change it to your own domain
    root $yii2StartRoot/backend/web;
    index index.php;

    #access_log  $yii2StartRoot/log/backend/access.log;
    #error_log   $yii2StartRoot/log/backend/error.log;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php?$args;
    }

    location /statics {
        alias $yii2StartRoot/statics/web/;
    }

    # uncomment to avoid processing of calls to non-existing static files by Yii
    #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
    #    try_files $uri =404;
    #}
    #error_page 404 /404.html;

    location ~ \.php$ {
        #include fastcgi_params;
        include fastcgi.conf;
        fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
    }

    location ~ /\.(ht|svn|git) {
        deny all;
    }
}
```

**Remove `'baseUrl' => '/backend'` from `/my/path/to/yii2-start/backend/config/main.php`.**

- Use the URL `http://yii2-start.domain` to access application frontend.
- Use the URL `http://backend.yii2-start.domain` to access application backend.

Notes:

By default will be created one super admin user with login admin and password admin12345, you can use this data to sing in application frontend and backend.

Themes:

  • Application backend it's based on "AdminLTE" template. More detail about this nice template you can find here.
  • Application frontend it's based on "Flat Theme". More detail about this nice theme you can find here.

yii2-start's People

Contributors

asetss avatar bolmas avatar maxxi165 avatar nikosid avatar seesoft-dev avatar tom910 avatar vova07 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

yii2-start's Issues

Не работает загрузка изображений

Добавил extensions и wrongExtension, но на save падает (выдает ошибку 500), перепробовал очень многое. (как ни странно в канвас изображение подгружается, но на /my/settings/uploadTempAvatar?fileapi140842888274010 выдает 500)

add static keyword to models scopes functions

Example: in model Blog.php
public function published($query)
{
return $query->andWhere('status = ' . self::STATUS_PUBLISHED);
}
to
public static function published($query)
{
return $query->andWhere('status = ' . self::STATUS_PUBLISHED);
}
otherwise if empty table you get error

Проблемка с модулем rbac

Есть проблемка с авторизацией, а точнее модулем rbac.

[error][yii\base\InvalidParamException] exception 'yii\base\InvalidParamException' with message 'Unknown authorization item '2'.' in C:\OpenServer\domains...\vendor\yiisoft\yii2\rbac\PhpManager.php:200

Stack trace:
#0 C:\OpenServer\domains...\common\modules\users\modules\rbac\components\PhpManager.php(23): yii\rbac\PhpManager->assign(1, 2)

String Validation Message

May be it's not a right time and place, but in this article http://habrahabr.ru/post/185236/ the question had been risen how to pass custom message to the string validator. Here is the answer.

Yii2 string validator has 2 special props for string being 2short and 2long. The names are yii\validators\StringValidator::tooShort and yii\validators\StringValidator::tooLong. Setting this props in rules ['name', 'string', 'min' => 3, 'max' => 20, 'tooShort' => 'Make it longer than 3 chars, 'tooLong' => 'Make it less then 20 chars'] will do the job.

Other validation messages can be passed in 'message' ['name', 'string', 'message'=>'blah blah blah blah blah blah blah blah blah blah blah blah blah blah ']

config for nginx, apache

думаю не хватает в описании настроек для web серверов.
(nginx) сегодня пол дня мучался со statics, написав root вместо alias.
а backend с alias не увидел css. пока сделал backend поддоменом.

intalation

Hi where can i "Set document roots of your Web server: /path/to/yii2-start/".
thanks in advanced.

Некоторые ошибки после устаноки.

После установки на Ubuntu 14.04, требует дать права на создание и запись следующих папок:

  • frontend/protected/runtime
  • frontend/web/assets

Это понятно и не сложно сделать, но для новичкок, может быть проблемой.
Думаю стоит либо, добавить в туториал, либо изменить файл init.

Также, при попытки авторизации, выдает ошибка:

yii\web\Request::cookieValidationKey must be configured with a secret key.

Решение здесь: http://www.yiiframework.com/forum/index.php/topic/56238-cookievalidationkey-must-be-configured-with-a-secret-key/

Обновили ImageValidator надо пофиксить "fileapi"

После обновления yii/ImageValidator перестала работать загрузка файлов так там идет проверка типа изображения. У себя пока закоментировал эту проверку.

Setting unknown property: yii\validators\ImageValidator::Type
Setting unknown property: yii\validators\ImageValidator::wrongType

TinyMCE

Здравствуйте. Попробовал Ваше решение, чтобы начать изучать Yii2, но столкнулся с тем, что поля ввода у TinyMCE не кликабельны и никакие данные в них ввести не получается. Пытался зарегистрироваться у Вас в демо, чтобы проверить есть ли там такая проблема, но письма не получил на почту.
Вопрос такой: Работает ли на Вашем демо TinyMCE? Каким образом можно исправить эту проблему?

Обновление через Composer

А можно как то через Composer обновлять?
Пишу
composer update --prefer-dist
он обновляет только вендоры.

Lazy регистрация, загрузка аватара пользователя

Здравствуйте!
Это отличный набор для быстрого старта! Спасибо!

Решил расширить функционал, и прикрепить EAuth.
Возникла такая проблема, не могу понять, каким образом заставить сработать аплоадер авы. Авторизация через соцсеть проходит, пользователь добавляется в базу через common\modules\users\models\User. Но как загрузить аву через FileApi, не могу понять)
Можно ли как-то в модели User вызвать метод "загрузить файл по url и вернуть ссылку на изображение"?

С Уважением!

yii2-start и cms

@vova07 не думал основы этого сделать cms на yii2? yupe на 1,им далеко до 2,а мы почти готовы.

Могу помочь и другие тоже поможет.

Ошибка во время регистрации нового пользователя

Ошыбка во время регистрации нового пользователя:
Missing argument 2 for yii\db\BaseActiveRecord::afterSave(), called in C:\xampp\htdocs\yii2-start-master\common\modules\users\models\User.php on line 546 and defined
В базу юзер добавляется. Но зайти из под него я немогу!

Yii-debug не работает

Вместо тулбара

Not Found (#404): Страница не найдена.

В консоли

GET http://my-site.com/debug/default/toolbar/?tag=52e3e10d40d70 404 (Not Found) 

gii

Hi:
After instalation i cant made use of gii.

Невозможно создать пост через frontend форму (ошибка FileAPI)

При попытке создания поста через frontend форму, невозможно загрузить изображения:
screenshot_14
Вероятно из-за этой же ошибки невозможно создать пост в блоге.
Данная ошибка наблюдается только во frontend форме, backend работает как положено, изображения загружаются, посты редактируются и создаются.

Ошибка

Приветствую. С горем пополам установил ваш блог. Для этого пришлось с денвера на OpenServer переползать. Главная и статические страницы работают нормально, а вот со страницами списка юзверей и страницы статьи - выдает ошибку: http://clip2net.com/s/iaXITk http://clip2net.com/s/iaXJw9

Что не так сделал? (

PurifierBehavior не работает

Если заполнить и attributes и textAttributes, то срабатывает только метод PurifierBehavior->textPurify(), а PurifierBehavior->purify() вообще не вызывается.
Если прописать в начале метода PurifierBehavior->purify()

public function purify($event)
{
    die('test');
    ...
}

то die не срабатывает.

Так и не смог найти причину... возможно изменения в фреймворке. Подскажите, как исправить?

Post updating

Не проходит апдейт поста для поле "текст"

Ошибка при логине Bad Request (#400)

При первом входе в админ панель выдает Bad Request (#400) Unable to verify your data submission, если попробовать повторно то заходит нормально, это только в production, в development такое не замечал

Ссылка для активации нового емайл адреса не работает

Ссылка для активации нового емайл адреса не работает, при переходе всплывает ошибка:

Unknown Property – yii\base\UnknownPropertyException
Getting unknown property: common\modules\users\models\UserEmail::user

  1. in C:...vendor\yiisoft\yii2\base\Component.php

if (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
} else {
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}

  1. in C:..\frontend\protected\modules\users\controllers\DefaultController.php – yii\db\BaseActiveRecord::__get() at line 374

if ($model = UserEmail::find()->where(['and', 'email = :email', 'token = :token', 'valide_time >= :time'], [':email' => $email, ':token' => $key, ':time' => time()])->one()) {

        $model->user->email = $model->email;

        if ($model->user->save(false) && $model->delete()) {

Не удается открыть backend

После сообщения о том, что приложение стало совместимо с бетой, и выполнения всех шагов не удается достучаться до backend-а. Ошибка:

PHP Compile Error – yii\base\ErrorException
Declaration of common\modules\users\modules\rbac\rules\NotGuestRule::execute() must be compatible with yii\rbac\Rule::execute($user, $item, $params)

in /var/www/demo/common/modules/users/modules/rbac/rules/NotGuestRule.php at line 9

Class frontend\modules\site\Site does not exist

Route: site/default/index
Error:
ReflectionException
Class frontend\modules\site\Site does not exist

in C:\wamp\host2\vendor\yiisoft\yii2\di\Container.php at line 409
*/
protected function getDependencies($class)
{
if (isset($this->_reflections[$class])) {
return [$this->_reflections[$class], $this->_dependencies[$class]];
}
$dependencies = [];
$reflection = new ReflectionClass($class);

in C:\wamp\host2\vendor\yiisoft\yii2\di\Container.php – yii\di\Container::getDependencies('frontend\modules\site\Site')

Подключеие tests

Не хватает TDD в этой структуре. Желательно в каждом модуле предусматреть tests
tests/unit
tests/functional

FileApi and $request->csrfVar to $request->csrfParam

В Yii2 поменялся параметр Request:csrfVar to Request::csrfParam
К сожалению долго оформлять pull Request

В файле common/extensions/fileapi/FileAPI.php в методе init()

    if ($request->enableCsrfValidation) {
        $this->settings['data'][$request->csrfVar] = $request->getCsrfToken();
    }

поменять на

    if ($request->enableCsrfValidation) {
        $this->settings['data'][$request->csrfParam] = $request->getCsrfToken();
    }

Can't access gii

First: this is a great application, exactly what I was looking for.

But somehow I can't access the gii module (on a fresh install).

When I try to access it via mydomain.local/gii I get a 404 error.

Am I missing something?

Регистрация пользователя через атрибуты

Данный решения красивее. Думаю на втором версии делаешь так.Форму регистрации можно по отдельности. Эту переделать времени нету :[

в модели юзера

   public static function create($attributes)
    {
        /** @var User $user */
        $user = new static();
        $user->setAttributes($attributes);
        $user->setPassword($attributes['password']);
        $user->generateAuthKey();
        if ($user->save()) {
            return $user;
        } else {
            return null;
        }
    }

форма

   public function signup()
    {
        if ($this->validate()) {
            return User::create($this->attributes);
        }

        return null;
    }

Контроллер

   public function actionSignup()
    {
        $model = new SignupForm();
        if ($model->load(Yii::$app->request->post())) {
            $user = $model->signup();
            if ($user) {
                if (Yii::$app->getUser()->login($user)) {
                    return $this->goHome();
                }
            }
        }

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.