How to integrate Yii-auth in Yii-app? - php

I just created a Yii-App (from https://github.com/Crisu83/yii-app) with composer and it suggests Yii-Auth to manage Authentication, so I registered Yii-Auth and installed it, and I don't know how to integrate Yii-Auth in the Yii-App project (I wouldn't know how to integrate other extensions either), could someone guide me through the integration process, please?
Thanks a lot!

The strings 'auth.components.AuthBehavior' and 'auth.components.AuthWebUser' are path aliases. See the definitive guide for more information on Yii path aliases.
The 'auth' will be defined somewhere in this module. (I do not know where because I am not familiar with this particular module.) It would be cleanest to find the definition of the 'auth' alias and change that to match your directory structure.
If you do not want to do that, you could replace the string with something like '???.vendor.auth.components.AuthBehavior'. I do not know the exact alias, because I do not know your directory structure.
Hope this helps. If not, show you directory structure.

Related

.gitignore, adminLTE and changes in vendor, suggestion?

I'm trying to configure adminLTE in Laravel project. I have found a way of modifying it, but when I want to modify it, it has to be done in vendor/jeroennoten/laravel.../views/master.blade.php or page.blade.php for basics and if I want to modify menus and navs it has to be done in vendor/jeroennoten/laravel-adminlte/config/adminlte.php
By default in .gitignore is also vendor folder. Now, I'm wondering, how to manage all this with GIT cause I'm changing things in vendor file? What is the recommendation and/or best practice? Try not to change anything in vendor, and make views in resource folder (what looks kind of huge work for adminLTE), or to use i.e. !vendor/jeroennoten in .gitignore, track all changes and update it on gitHub.
Is there any additional things I should do if someone wants to pull the project so he/she can see changes in vendor.
I'm new to this, so if this seems kind of dummy question or there is completely different approach please have understanding.

Phabricator Development Guide to customize the logic

I need to customize few logic in the Phabricator tool. But I couldn't able to find where the logic, MySql queries and view files are located.
Does it have any MVC folder structure like codeigniter or any other specific pattern?
Can anyone please help me to understand this or please share any links to understand the coding structure and customize the logic.
Thanks in advance!
Phabricator documentation would the first point of start:
Example of Extension for Phabricator
Adding a new class
Most of them add new features to Phabricator functionality. The problem with changes is that you should maintain them, (use patch) to add them after every update.

Update Laravel main app directory

Is there an easy way to incorporate changes to the main Laravel app, when there are framework updates, other than manually incorporating the changes described in the documentation (http://laravel.com/docs/5.1/upgrade)?
I'm thinking some kind of composer command that patches the main app and not only the vendor dir. Does such a thing exist?
Thanks in advance.
Apparently, Shift is exactly what you're looking for, although it's still in its alpha. You can contact its creator if you want to help him test the tool.
Reference: http://jason.pureconcepts.net/2015/11/laravel-automated-upgrade-tool-shift/

Automatically discover composer packages

I'm wondering what the best way (if there is a way) for an application to auto-discover [relevant] PHP "packages" installed by Composer.
My use case specific scenario:
I have a PHP app that includes my "framework" (for lack of a better word). This framework brings some basic functionality (routing, admin etc).
I'm slowly building in more advanced functionality, say, a blog module. This module is entirely self contained in it's own directory (but obviously has dependencies on the framework).
I'd like this blog module to be a self contained Composer package, so that I can selectively require the package in my app's root composer.json file.
Now, I need for the framework to know that it's there so that it can, for example, set the routing correctly and load up any admin functionality that the module requires.
What I've thought so far:
I'm relatively experienced in PHP, but "proper" OOP and autoloading is a little bit beyond my knowledge at the moment, so please forgive if there are inbuilt functions to do this. I don't even know what terms to Google!
I have thought I could maybe read the installed.json file which composer puts at vendor/composer/installed.php but I'm not sure how to set up my packages (e.g. blog) so they announce what they are. I'd like to future proof it so that I'm not looking for known module names (or regexing vendor or package names), but rather looking for packages to say "hey framework, I know you! You can use me!"
Maybe I can somehow instruct Composer (through the package's composer.json file) to stick in an arbitrary key/value pair in installed.json?
Any suggestions welcome, or directions as to what sort of Googling I should be doing.
Oh welcome to the world of managing dependencies on your framework.
I have some experience with auraphp, where we dealt with similar issue. You can read the blog post Composer-Assisted Two-Stage Configuration .
So what we finally ended-up adding https://github.com/auraphp/Aura.Web/blob/a3870d1a16ecd3ab6c4807165ac5196384da62cd/composer.json#L26-L36 these lines in the packages that need to understand to load by the framework.
You can also see how this bundle can also get autoloaded with the configurations.
in your composer.json
https://github.com/harikt/Aura.Asset_Bundle/blob/6ea787979390e69bf6ecb1e33ce00ed90f306e2f/composer.json#L21-L27
and the config/Common.php ( https://github.com/harikt/Aura.Asset_Bundle/blob/223126cedb460e486c4f0b242719c96c14be5385/config/Common.php ) , note we have other development modes also. For a detailed look check https://github.com/auraphp/Aura.Web_Project or https://github.com/auraphp/Aura.Framework_Project
Hope that helps a bit to look into the code and work on your own solution.

Cakephp 2.1 naming convensions issue in version change

I have just installed CakePHP 2.1. And just see that the naming convention of its is just change lot from the older version which making me crazy.
Like it was app/controllers while now it is app/Controller same way
app/models - app/Model
app/views - app/View
I know there must be some advantage on doing this. But my problem is when I use the cake bake it is creating directory in the same old fashion i.e. controllers/models/views. Which is no more accessible from the URL & obviously will throw an error.
Is anyone there who has face the same issue ? Is there any solution that cake bake also use the same conventions ?
Any help will be appreciate. Thanks.
you can always use explicit paths:
/path/to/app_dir>..\lib\Cake\Console\cake bake
from your APP dir of the current cake project.
this is foolprove and always works with the right cake version.
I do it this way and use a shortcut on my keyboard to print this (up to "cake") on a single key stroke.
The reason for the change is to be able to better autoload files based on their kind (using App::uses('User', 'Model'); and later , when namespaces are introduced (3.0?) they can be loaded a lot more easy because you will call a class then like for example: "new \Cake\Model\User();"
About your bake problem: Make sure your environment is pointing to the correct "cake" shell file. I'm pretty sure yours is still pointing to the old 1.3 "cake" shell.

Categories