In PHPStorm is there a way to avoid indexing *.phar files? - php

I know how to exclude meta and log files from index inclusion but in my application's composer.json I have both Guzzle and Goutte listed as dependencies. Goutte includes a goutte.phar which in turn contains the source code for Guzzle. So when I go to use autocompletion I get this:
Is there anyway to exclude a *.phar file (or any specific PHP file for that matter) from the PHPStorm indices?

Right click on that file and select mark as -> excluded?

From the docs :
In the Project tool window, select the required .phar archive and choose Exclude phar from project on the context menu of the selection.

otherwise you can add *.phar to Settings -> Editor -> File types -> Ignored files and folders
or alternatively to Settings -> Directories -> Exclude files

Related

Translate text in config folder cakephp 3

I'm trying to internationalize a CakePHP 3 application using cake i18n extract. All the texts coming from src folder are translated fine, but I have some text that I put inside config/bootstrap.php but those don't get translated even though I placed them inside the double underscore function __('My text') and I also generated the translation files in src/Locale folder (the same way I did for the other texts that work.
Any idea why my texts in config/bootstrap.php won't get translated?
Thanks in advance for any help
They do not show up because by default the extract task only looks in the src folder. When running the task it will ask you from what paths to extract, and it should only list the src folder by default.
You can either add your custom paths interactively in the shell when it asks you for the folders that should be looked up, or you can use the paths option to define them in beforehand, like:
bin/cake i18n extract --paths /var/www/app/config,/var/www/app/src
When doing so may also want to use the output option to specify the output path, as the task will use the first path as the root for output, ie with the above paths it would put the files in config/Locale instead of src/Locale. Alternatively you can switch the paths, but then the messages from the config folder files would appear at the bottom of the .pot file.
See also
Cookbook > Console Tools, Shells & Tasks > I18N Shell > Generating POT Files > Extracting from multiple folders at once
It depends on where you set the application locale with I18n::setLocale(). Your application using App.defaultLocale setting to determinate wich language sould be shown.
If you change your language in your controller, your configuration files already loaded so this will not effect on these files just on those files what will be loaded after your setLocale.
Try to change your language before translatable files loaded, or load translate configuration files in controller after changeing the appLocale.

Eclipse PDT/PHP : Remove folder from validation

I use Eclipse with PDT, Version: Mars.2 Release (4.5.2).
I have a folder called "var" in my PHP project that I would like to exclude from build, so I excluded it in Build Path using var/**. Though, even then, it still give me errors in this folder after doing a clean/build. I also tried var/, var/* and all combinations of those. Nothing do it, Eclipse still validate those files. Those are temporary files, so it's really annoying to have the IDE working for nothing on those files.
Buld Path is for PHP validator excludes. You have couple options:
Exclude from workspace. Right click on level up dir (project) -> Properties -> Resource -> Resource Filters.
Create excludes inside project -> validation page.
Mark dir as library. When is part of build path, right click on it -> Use as library folder.

Can you turn a folder of PHP files into a netbeans project?

I have a folder with several subdirectories containing PHP files. At the moment I open each file individually in Netbeans. However, I would like to open this folder as a project, so I can use features like searching for a line throughout the entire project. Is this possible in Netbeans? What would be the best way to achieve this?
Create a new project, set sources directory to the one you have with current files
(might want to back up the files before if anything goes wrong).
Go in Netbeans. Select Files->New Project. A window will open, in that select PHP in Categories. Click Next. In Project Name give the name of your project(as seen in netbeans), in Sources Folder select the path to your project and click Next. In Run Configuration Make the settings according to your requirement to run the project. Now in PHP Frameworks Select ypur desired framework or just leave it blank and click FINISH.
You will See your project in Netbeans now.
Go to file->New Project and select PHP in category and follow the instruction.
In Source folder you need to choose your files folder so that it get listed.
go to FILE->new Project->select php in categories in left pane and php application with existing sources as Projects *in the right pane* ->next -> next till finish
When you add any directory in netbeans as a project, it add its only directory under the project directory. So if you need to add the numbers of directory in netbeans being a project, then i would like to suggest firstly to collect all directory in parent directory. then add it as a project.
Here is an explaination:-
directory- dir
lets you have dir1, dir2, dir3, dir4.
and according to you mentioned above all dir are projects.
You have to create a dirA and all dir1, dir2, dir3,and dir4 are subdirectory of dirA.
so the folder under dirA nbprojects(created by netbeans) will take care of all directories being the subdirectory of dirA.

Eclipse PHP - cannot find validation section to exclude .xml files from validation

Using Eclipse for PHP Developers Version: 3.0.2 (latest Zend download)
What I want to do, is to exclude some single .xml / .html files from validation. Seemed to be straight forward.
SO " https://stackoverflow.com/a/5288496/356726 " says to use Project / Properties / Validation, but I do not have this menu item.
SO " How to exclude specific folders or files from validation in Eclipse? " refers to Window / Preferences. I checked through the sections in order to find the exclude sections, but I was unable to locate it. I can set project specific settings, but where do I exclude single files?
What do I miss? I am sure it is pretty simple.
Project Properties:
Window / Preferences:
This worked for me (Eclipse Indigo, Java project):
project -> right click -> Properties -> Validation
check Enable project specific settings
XmlValidator: check Manual, check Build, click "..." for Settings
Add Exclude Group, select it
Add Rule -> Folder or file name -> select file you want to ignore
refresh project (or close and open)
This instruction assumes the button Add Exclude Group in step 4 is enabled. However, in my case the button was disabled. I don't know the reason but I discovered following workaround:
4a. Add (empty) Include Group
4b. Open file PROJECT_HOME.settings\org.eclipse.wst.validation.prefs
4c. Edit key vals/org.eclipse.wst.xml.core.xml/groups - change 07include00 to 07exclude00 near the end of string
4d. Refresh project, open project properties again

Adding more source folders to a NetBeans PHP project

Is it possible, with or without plugin, to add more source folders to a PHP project, just like in a Java project?
I have downloaded and tested the Java version of NetBeans, and there is clearly possible to add more source folders. But not in the PHP version?
you can add paths for all newly created PHP projects from:
netbeans options > PHP section > Global include path
or you may add project specific include paths in a project's "project properties" (right click on a project in the projects view", and then choose "PHP Include Path" from the left side section.
although you are not allowed to edit a project included sources. you might as well create an additional project in Netbeans and call it like "my-include-path", then add all the folders in your desired include paths to this project. now you can edit your included files in this project.
When you right-click in the projects panel (Netbeans 6.9.1), there's an option 'Project Group'. This allows you to add the current projects (In this case the php and the js project) to be grouped and opened as one.
Also useful to automatically open additional projects used for reference.
Under project properties, the source folder is only one.
However, you could add folders to the PHP Include Path if you are trying to use files from another folder.
At this time, it looks like NetBeans PHP projects does not support multiple source folders.
I have added a feature request to the NetBeans' Bugzilla: http://netbeans.org/bugzilla/show_bug.cgi?id=180889
"Global include path" and "PHP include path" does not work for me.
My personal solution is to add the extra_path before the include/include_once statements in this way:
set_include_path(get_include_path() . '$extra_path);

Categories