How to find all files with a function in phpstorm? - php

How I can find and show all files in Phpstorm where this method
$this->other_model->any_method()
is called?

cmd+shift+f for Mac and ctrl+shift+f for Windows will find any piece of text throughout the project or directory. Or you could use alt+f7 to find usages.
PHPStorm Keyboard Mapping.
Viewing Structure of a Source File.

You can search for symbol with combination Ctrl+Shift+Alt+N. This combination allows you to search not only PHP classes/methods but also PHP variables, CSS classes etc.
If you want to find method usages in files:
click on your method and press Alt+F7

If you want to search any composition of your desire search, you can use from searching everywhere. I prefer to use this because PhpStorm makes it possible to look for any item of the source code, databases, actions, elements of the user interface, etc. in a single action.
to use that, only press search button in the right upper corner of phpStorm or 2 times press shift key on your keyboard. Now you can find your search everywhere. This is great functionality of phpStorm.
To read more information about using this search method, go to the following link:
Searching Everywhere
To See all the methods for search in phpStorm, Go to the following link:Searching Through the Source Code

Related

Netbeans - shortcut for importing namespaces

does anyone know if there is a key combination for importing classes in Netbeans?
By pressing enter when I get the suggestions, the namespace is imported in the method like this:
public function index(\Illuminate\Http\Request){
What I want to achieve instead, is to add a line use Illuminate\Http\Request in the top of the file. How can I do this in netbeans? I have seen it in Phpstorm.
Also, another question a little off the topic, but I have seen people generating html5 code by typing html5 and with some key combination they generate a doctype, html, head and body. How can I do this?
For the first part
In newer versions of Netbeans , you can press Ctrl+Shift+I (Alt+Shift+I won't work as expected, though).
First, it searches for any smart or fully qualified instances in your file and then asks you of what types the found ones should be. It then adds fully qualified use statements to the top of your file and changes existing instances in the source to unqualified.
For the second part
You have to use a plugin called Emmet

How to remember PHP's parameter order?

This will be quite a short question as there is little to no explanation required.
Sometimes I'm having a hard time remembering in what order parameters are supposed to be used in PHP functions. What I mean by this is that I sometimes just do not know if I should use needle, haystack or haystack, needle.
Use an IDE like PDT for Eclipse https://eclipse.org/pdt/
It will show you the parameter order automatically when typing.
PHP unfortunately is quite inconsistent in this regard and remembering all of them in your head might be a taks of a life time.
Ill keep the answer as short as the question: RTM
For example
http://www.php.net/stristr
http://www.php.net/substr
That will tell you the order for every function like that and alot more about it. Change the function name, see the order.
Whenever in doubt, Type php.net/[function_name] and you dont have to remember everything about the function.
If use Firefox as web browser, go to the PHP Manual page, write something (the name of the function, maybe) in the Search box of your browser.
Open the list of search providers (using the Down arrow if it does not open automatically). At the end of the list you'll find Add "PHP.net search".
After you add PHP.net as a search provider, searching for help directly from your browser becomes an easy job.
How to install the PHP.net search provider in Chrome:
As for Firefox, go to the PHP.net website then open Chrome Settings (you'll find it on the menu) and press the "Manage search engines..." button. A new window titled "Search engines" appears an the bottom list contains the search engines provided by the pages that are open now in various tabs and are not already installed.

Replacement for writing out entire domain?

I am in the process of creating a website that will eventually be moved to a different domain. Every link on the site currently starts with http://www.mydomain.com/folder. This means that when I move domain I will have to change each and every link. Is there a replacing method of this? Sorry that this is a very basic question, I wasn't quite sure what I was looking for. Thanks for any help.
Firstly; best way is to make it configurable. There should be a global variable:
HTTP_SERVER = 'http://www.mydomain.com/';
and when you want you build a link, you should use:
Link To Folder
But let's get back to your question;
You can use an IDE to search and replace in all of the files in a specific folder. I use Visual Studio which you can choose to search in entire project and replace. But if you want other quick solutions, the best one comes to my mind is Notepad++, you can open a bunch of files and search & replace among them. Another one is Sublime Text which is a great lightweight text-editor / IDE that i use.
I would use an IDE to do a global search and replace across all files in the project.
try declaring a $base_url="www.domain.com/folder" in your connection file which will be included in all pages. so that you can just change the base url there only. and when you want the link call it as $base_url.'/page_name.php';

TextMate: Anyway to browse/trace variables through classes/objects/files?

Is there a addon where let say I want to see the origin/stack/trace of a variable I can do so?
I primarily want to see where variables are coming from, what classes and files they go through.
If there is another editor that does this well Ill take suggestions as well!
Thanks.
I don't think TextMate is able to do that, with or without a plugin.
-- START EDIT --
When I was still using it and I wanted to see (and possibly jump to) where a method or property came from I just used Search in Project.
-- END EDIT --
Vim in conjunction with ctags and cscope can help you jump from instance to prototype and vice-versa — wether it's in the current file or not — with <C-]> (or <C-$> on my french Mac keyboard); with TagList or TagBar you can see the structure of your code… but none of this can give you the clean overview you are looking for. But there is probably a plugin for that.
But if that kind of features is important for you it is typically a good reason to use an IDE instead of a text editor. In Eclipse, for example, you have a Type Hierarchy view that does most of what you want and possibly other tools to do the rest. I haven't tried every single IDE under the sun but I think a similar or more powerful feature exists in all of them.
Maybe in Emacs…

Jump to function declaration in php

I have the following ide's for php
Dreamweaver
php-Eclipse
Textpad
I wish to jump to a function's definition which is located in another file which is not yet open. How could I do that. I am studying a websites code and have the entire directory structure in my local root folder. I come across certain functions and I don't know in which file their definition is. Please suggest something.
In eclipse PDT IDE put mouse over class name, property, method or function name (must be in opened eclipse project) and press CTRL + clic.
It work with almost all declarations, even constants and class constants. In most case it will work, but it can have trouble with some dynamic property assignement like magic methods or certain injected dependency.
The file will be opened, and if target is in same file code view will scroll to the declaration
Press F3 in eclipse and you will find the declaration.
To jump to function definition for Dreamweaver just add this extension:
http://code.google.com/p/dwoop/.
Also you can add Autocomplete feature to Dreamweaver by going to Site --> Site Specific code hints --> select a folder which you want to scan for autocomplete --> save it with any custom name you want.
This works with any type of project (wordpress, codeigniter...)
I wish to jump to a function's
definition which is located in another
file which is not yet open.
I can suggest you about dreamweaver, the one i use. Point the cursor at the file that is included via php's include, require, etc or within link's href and src attribute and press Cntr+D and that file should open.
For functions, just right click anywhere on the document, in the context menu you should see the Functions link about all functions defined in the document.
phpDesigner can do that
In an opposite direction, and perhaps out of question's field, but if your code if OOP and you want to study it you can try automated tools to get UML view of its architecture , but these softwares are generally not free.
I found a way of going to the function definition. Using help in dreamweaver and selecting the option of searching wihtin a folder type 'function function_name()' and unselect all the checkboxes below.
if you press find it will start opening pages which containg the expression or find all will not open any pages but show the list of all the pages in the bottom panel.
Well, I'm currently working with Dreamweaver CC. If you want to jump to Function Definition from code, just select the desired function and then right click -> then select "Find Selection" option or you can use "Shift+F3", and you will be redirected to the code where the function is defined. enter image description here

Categories