brew doctor

brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libpcre2-8.0.dylib
    /usr/local/lib/libpcre2-posix.0.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
    /usr/local/include/ncurses/curses.h
    /usr/local/include/ncurses/eti.h
    /usr/local/include/ncurses/form.h
    /usr/local/include/ncurses/menu.h
    /usr/local/include/ncurses/nc_tparm.h
    /usr/local/include/ncurses/ncurses_dll.h
    /usr/local/include/ncurses/panel.h
    /usr/local/include/ncurses/term.h
    /usr/local/include/ncurses/term_entry.h
    /usr/local/include/ncurses/termcap.h
    /usr/local/include/ncurses/tic.h
    /usr/local/include/ncurses/unctrl.h
    /usr/local/include/node/ares.h
    /usr/local/include/node/ares_version.h
    /usr/local/include/node/nameser.h
    /usr/local/include/node/node.h
    /usr/local/include/node/node_buffer.h
    /usr/local/include/node/node_internals.h
    /usr/local/include/node/node_object_wrap.h
    /usr/local/include/node/node_version.h
    /usr/local/include/node/openssl/opensslconf.h
    /usr/local/include/node/uv-private/ngx-queue.h
    /usr/local/include/node/uv-private/stdint-msvc2008.h
    /usr/local/include/node/uv-private/tree.h
    /usr/local/include/node/uv-private/uv-bsd.h
    /usr/local/include/node/uv-private/uv-darwin.h
    /usr/local/include/node/uv-private/uv-linux.h
    /usr/local/include/node/uv-private/uv-sunos.h
    /usr/local/include/node/uv-private/uv-unix.h
    /usr/local/include/node/uv-private/uv-win.h
    /usr/local/include/node/uv.h
    /usr/local/include/node/v8-debug.h
    /usr/local/include/node/v8-preparser.h
    /usr/local/include/node/v8-profiler.h
    /usr/local/include/node/v8-testing.h
    /usr/local/include/node/v8.h
    /usr/local/include/node/v8stdint.h
    /usr/local/include/node/zconf.h
    /usr/local/include/node/zlib.h
    /usr/local/include/pcre2.h
    /usr/local/include/pcre2posix.h

Warning: Unbrewed .la files were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
    /usr/local/lib/libpcre2-8.la
    /usr/local/lib/libpcre2-posix.la

Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
    /usr/local/lib/pkgconfig/libpcre2-8.pc
    /usr/local/lib/pkgconfig/libpcre2-posix.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
    /usr/local/lib/libform.a
    /usr/local/lib/libform_g.a
    /usr/local/lib/libmenu.a
    /usr/local/lib/libmenu_g.a
    /usr/local/lib/libncurses.a
    /usr/local/lib/libncurses_g.a
    /usr/local/lib/libpanel.a
    /usr/local/lib/libpanel_g.a
    /usr/local/lib/libpcre2-8.a
    /usr/local/lib/libpcre2-posix.a
Error: Formulae found in multiple taps: 
 * homebrew/php/php56
 * josegonzalez/php/php56

Please use the fully-qualified name e.g. homebrew/php/php56 to refer the formula.

Yii2 RBAC

一、先是配置RBAC的数据库管理方式

return [
    'components' => [
        'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=localhost;dbname=yii',
            'username' => 'root',
            'password' => '',
            'charset' => 'utf8',
        ],
        'authManager' => [
            //'class' => 'yii\rbac\PhpManager',
            'class' => 'yii\rbac\DbManager',
            'defaultRoles' => ['guest'],
        ],

    ],
];

二、之后执行

./yii migrate --migrationPath=@yii/rbac/migrations

yii/rbac/migrations目录下有准备好的,数据库结构,命令指示导入而已。
执行结果大概就是这个样子

Yii Migration Tool (based on Yii v2.0.4)

Total 1 new migration to be applied:
	m140506_102106_rbac_init

Apply the above migration? (yes|no) [no]:yes
*** applying m140506_102106_rbac_init
    > create table {{%auth_rule}} ... done (time: 0.028s)
    > create table {{%auth_item}} ... done (time: 0.024s)
    > create index idx-auth_item-type on {{%auth_item}} (type) ... done (time: 0.023s)
    > create table {{%auth_item_child}} ... done (time: 0.026s)
    > create table {{%auth_assignment}} ... done (time: 0.024s)
*** applied m140506_102106_rbac_init (time: 0.136s)


Migrated up successfully.

YII2自定义组件

以高级应用模板为例,假设有这么一个发送手机短信的组件需求
第一步先建立一个组件
common/components/ShortMsgService.php

/**
 * Class ShortMsgService 手机短信组件
 */
class ShortMsgService {

    /**
     * @var 秘钥
     */
    public $accessKey;

    public function send($phone,$message){
        echo $this->accessKey , $phone , $message;
    }

}

第二步配置加载组件
common/config/main.php

return [
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],

        'ShortMsgService' => [
            'class' => 'common\components\ShortMsgService',
            'accessKey' => 'accessKey Here',
        ],

    ],
];

第三步在控制器中尝试使用组件

$sms = Yii::$app->ShortMsgService;
$sms->send('18588888888','Are you ok');