Phpstorm Upload to Zaolivetea.com Failed: Could Not Change to Work Directory /.
Composer dependency manager
PhpStorm integrates with the Composer dependency managing director, which allows you to declare packages from Packagist or a custom repository equally your project's dependencies and manage them from the IDE.
PhpStorm provides comprehensive coding assistance for working with composer.json as well as the dedicated user interface for running mutual Composer commands:
-
Managing Composer Projects with Composer,
-
Working with composer.json,
-
Performing boosted tasks.
When y'all run the in a higher place commands, PhpStorm displays their output via the Composer Log console.
If you wish to use the full range of Composer commands in a PhpStorm projection, you can configure and run Composer equally an external command-line tool.
Download and install Composer
For details on installing Composer, refer to the Composer official documentation.
If y'all work in a local environment, Composer commands in PhpStorm are run via the configured local PHP interpreter. You lot tin can download and install Composer manually as a system-wide standalone tool, or take PhpStorm download information technology automatically when you create a new Composer projection, initialize Composer, or invoke other Composer commands in an existing project.
Additionally, PhpStorm enables you run Composer commands via whatsoever configured remote PHP interpreter.
Manage Composer projects
In PhpStorm, you can create new projects based on the Composer package of your choice or work with existing Composer projects. PhpStorm will resolve the dependencies and use the information from composer.json to automatically employ the sure configuration options.
Create a new Composer projection
When you create a new Composer project, PhpStorm creates a project based on the Composer parcel of your choice, resolves the dependencies and installs them under the projection's vendor directory.
-
Choose or click Create New Project on the PhpStorm Welcome screen.
The New Project dialog opens:
-
In the dialog, specify the project's parameters:
-
Choose the project type and location:
-
In the left-manus pane, select Composer Project.
-
In the Location field on the right-mitt pane, specify the folder where the project will be created.
-
-
Choose how the Composer commands will be executed:
-
To run commands via a globally installed composer executable, choose 'composer' executable and specify its location in the field.
-
To run commands via the local composer.phar annal, cull composer.phar. Then, either specify the location of the existing composer.phar file in the field or select the Download composer.phar from getcomposer.org checkbox to download a new example of the file. The downloaded composer.phar file will exist saved under the projection root folder.
And then, cull one of the configured local PHP interpreters from the PHP interpreter list. Refer to Configure local PHP interpreters for details.
Optionally, in the Command line parameters field, type the additional command line parameters.
-
-
In the Packet area, type the proper name of the desired package in the Parcel field. To employ code completion, printing Ctrl+Space. Then choose the relevant version from the Version to install listing.
-
-
Click Create. The create-project Composer command will exist invoked with the selected package. Every bit a result, the Composer project will exist created, whose configuration and structure depends on the selected package. After that, the created PhpStorm project opens.
Initialize Composer in an existing projection
When you initialize Composer in a project, composer.json is created. This file lists the project dependencies and other metadata and is automatically gear up as the project default.
-
From the main menu, select .
The Composer Settings dialog opens:
-
Choose how the Composer commands will be executed:
-
To run commands via a globally installed composer executable, cull 'composer' executable and specify its location in the field.
-
To run commands via the local composer.phar archive, choose composer.phar. And so, either specify the location of the existing composer.phar file in the field or select the Download composer.phar from getcomposer.org checkbox to download a new example of the file. The downloaded composer.phar file volition exist saved under the project root folder.
So, choose i of the configured local PHP interpreters from the PHP interpreter listing. Refer to Configure local PHP interpreters for details.
-
To run commands via a remote interpreter, choose Remote interpreter.
-
From the CLI Interpreter list, select a remote interpreter to utilise, or click
and configure a new one as described in Configure remote PHP interpreters.
In nigh cases, PhpStorm detects path mappings automatically. If necessary, you can click
in the Path mappings field and specify them manually in the Edit Projection Path Mappings that opens.
-
In the Composer executable field, provide the name of the Composer executable. You tin can click
, and locate the executable in the Select Path On The Server dialog that opens.
-
-
-
Click OK to close the Composer Settings dialog. PhpStorm creates a composer.json stub file and opens it in the editor:
Complete the lawmaking or accept the generated values. For details on working with the composer.json file, refer to Composer.json: Project Setup.
Open an existing Composer project
When you lot open an existing Composer project, PhpStorm uses the information independent in the composer.json file to automatically utilize the sure configuration options, for example the project's content roots and PHP language level.
-
Click Open on the Welcome screen or choose from the chief menu, then choose the folder where your Composer project is stored.
PhpStorm will show a notification:
-
Click . In the Composer dialog that opens, specify the location of the composer.json file. If PhpStorm detects an existing file, the field volition be filled automatically:
-
Configure the project settings:
-
By default, all packages nether the vendor/*/* directory are excluded from the projection and added as write-protected libraries. To protect them from editing, get out the checkbox selected. Otherwise, if you want to edit Composer packages under vendor/*/*, articulate the checkbox.
-
Make certain the checkbox is selected to automatically detect the PHP language level and configure project Source and Examination roots based on the configuration from composer.json.
PhpStorm is aware of PSR-0/PSR-4 source roots and their namespace prefixes. It sets the Source root
based on the
autoloadsection, and the Tests rootbased on the
autoload-devdepartment. PhpStorm also detects the PHP language level based on thephpsetting in therequiresection.Because composer.json contains the well-nigh up-to-date information about the project configuration, this automatic synchronization ensures that the Source and Test folders exactly friction match the project structure, and the correct PHP language level is ready automatically.
To acquire more nigh PSR and autoloading, refer to the Composer official website. For examples and details on synchronizing settings, refer to the PhpStorm weblog post. To acquire more about configuring content roots, see Content root.
-
To call back the bachelor package updates and provide better coding assistance in composer.json, PhpStorm runs the update --dry-run command in groundwork every time you open a project or modify composer.json. If necessary, y'all can disable running the control by clearing the Check for bachelor package updates checkbox.
Click OK to utilize the specified projection settings and close the dialog.
-
-
Prepare Composer commands execution:
-
Practise i of the following:
-
In the Settings/Preferences dialog (Ctrl+Alt+S), go to .
-
If you lot have a single composer.json file in your projection, select from the main menu to open the Composer Settings dialog.
-
-
Cull how the Composer commands will exist executed:
-
To run commands via a globally installed composer executable, choose 'composer' executable and specify its location in the field.
-
To run commands via the local composer.phar archive, cull composer.phar. Then, either specify the location of the existing composer.phar file in the field or select the Download composer.phar from getcomposer.org checkbox to download a new instance of the file. The downloaded composer.phar file volition be saved under the project root folder.
Then, cull ane of the configured local PHP interpreters from the PHP interpreter list. Refer to Configure local PHP interpreters for details.
-
To run commands via a remote interpreter, choose Remote interpreter.
-
From the CLI Interpreter listing, select a remote interpreter to use, or click
and configure a new one every bit described in Configure remote PHP interpreters.
In most cases, PhpStorm detects path mappings automatically. If necessary, you can click
in the Path mappings field and specify them manually in the Edit Projection Path Mappings that opens.
-
In the Composer executable field, provide the name of the Composer executable. You can click
, and locate the executable in the Select Path On The Server dialog that opens.
-
-
-
-
Install the project dependencies:
-
If yous accept a unmarried composer.json file in your project, select from the main carte.
-
Otherwise, if you have several composer.json files, select from the context menu of the relevant ane. Run into also Appointing a default composer.json in a PhpStorm project.
Yous can also open up the composer.json file in the editor and click the Install shortcut link on top of the editor console.
-
Appoint a project default composer.json
Y'all tin have several composer.json files in one PhpStorm projection. For each composer.json, deportment are invoked from its context card in the editor or in the Project view, or using the shortcut links on pinnacle of the editor console. You lot can also appoint the default composer.json for your PhpStorm project. Composer deportment for it are invoked from the main card particular.
-
In the Settings/Preferences dialog (Ctrl+Alt+S), go to .
-
Specify the location of the default composer.json. If you have a single Composer configuration file in your PhpStorm project, the field is filled automatically.
-
By default, all packages under the vendor/*/* directory are excluded from the project and added every bit write-protected libraries. To protect them from editing, leave the Add packages equally libraries checkbox selected.
Otherwise, if y'all want to edit Composer packages nether vendor/*/*, clear the checkbox.
-
Make sure the checkbox is selected to automatically detect the PHP language level and configure project Source and Test roots based on the configuration from composer.json.
PhpStorm is enlightened of PSR-0/PSR-iv source roots and their namespace prefixes. It sets the Source root
based on the
autoloaddepartment, and the Tests rootbased on the
autoload-devdepartment. PhpStorm too detects the PHP language level based on thephpsetting in therequiredepartment.Because composer.json contains the well-nigh up-to-date information about the project configuration, this automatic synchronization ensures that the Source and Exam folders exactly match the projection structure, and the correct PHP language level is gear up automatically.
To learn more virtually PSR and autoloading, refer to the Composer official website. For examples and details on synchronizing settings, refer to the PhpStorm blog post. To learn more near configuring content roots, see Content root.
Work with composer.json
The composer.json file describes the dependencies of your project and may as well comprise other metadata. PhpStorm provides comprehensive coding assistance for working with composer.json and lets you perform many Composer-related tasks straight from the code editor.
Create a composer.json file
Y'all can create composer.json files manually. If Composer hasn't yet been initialized in the project, a newly created composer.json volition be automatically set as the projection default.
-
Do one of the following:
-
In the Project tool window Alt+1, select the directory in which you lot want to create a new file, and then choose from the main card.
-
Right-click the corresponding directory and select New from the context carte.
-
Press Alt+Insert.
-
-
In the popup carte du jour, select composer.json File. PhpStorm creates a stub of the composer.json file and opens it in the editor.
Use code completion in composer.json
-
Within composer.json, printing Ctrl+Space to utilise lawmaking completion when providing both the names of the sections and their content, for example:
-
License type and minimum-stability version,
-
Namespaces and paths in the
autoloadandautoload-devsections, -
Required PHP version and extensions besides as packages' names and versions in the
requireandcrave-devsections.
-
Use quick documentation in composer.json
-
Inside composer.json, press Ctrl+Q to view quick documentation for the element at caret.
Navigate from a composer.json tape to the project entity or setting
-
Within composer.json, position the caret at an entity such as an installed package, a class or a method within a script, a file path, or a url. Then do any of the following:
-
In the main menu, select
-
Press Ctrl+B
Alternatively, Ctrl+Click the record.
-
-
If yous accept a test framework or lawmaking quality tool installed as a project dependency, PhpStorm displays
next to the respective dependency record. Click it to jump directly to the respective Settings/Preferences page.
For details on using examination frameworks, run across Testing; for details on working with code quality tools, see and PHP lawmaking quality tools.
Manage dependencies
To install, update, or uninstall project dependencies, you demand to update the records in the require or require-dev sections in composer.json and then run the corresponding Composer command.
To retrieve the available package updates and provide better coding assist in composer.json, PhpStorm runs the update --dry-run command in background every time you lot open a project or modify composer.json. If necessary, you can disable running the command. In the Settings/Preferences dialog (Ctrl+Alt+S), become to and clear the Check for available package updates checkbox.
When you open up a project or modify composer.json, PhpStorm checks whether the vendor directory is present. If it is missing, PhpStorm displays the notification message.
Click the Run 'composer install' shortcut link in the notification message to quickly install the project dependencies. If necessary, you tin disable this notifcation past clearing the Notify about missing 'vendor' directory checkbox on the folio of the Settings/Preferences dialog (Ctrl+Alt+South).
Install dependencies
-
Inside composer.json, add the desired dependency record to the
requireorrequire-devsection. Press Ctrl+Space to get code completion both for the package proper name and version.
-
Practice one of the following:
-
Click the Install shortcut link on tiptop of the editor console.
-
If the Not-installed Composer packages inspection is enabled, PhpStorm will highlight the alleged dependencies that are non currently installed. Press Alt+Enter and select whether y'all desire to install a specific dependency or all dependencies at once.
-
When a new package is installed, PhpStorm creates a new subfolder under vendor and stores the package inside. If the composer.lock file. present in the electric current directory, the exact packages versions listed in it are installed. Otherwise, if the composer.lock file is missing, Composer will create it afterwards installing the packages, thus locking your projection to their specific versions.
Update dependencies
You lot can update packages to their latest versions individually, or update all the packages listed in the require and crave-dev sections of composer.json at once.
-
When a new package version is bachelor or the package versions requirements change, PhpStorm indicates this via the
icon in the editor gutter. It also provides the hint on the currently installed version and the version the package can be updated to.
Click
to update the bundle.
-
To update all packages, click the Update shortcut link on meridian of the composer.json editor console.
Uninstall dependencies
-
Remove the bundle record from the
craveorcrave-devsection of composer.json. -
Click the Update shortcut link on top of the composer.json editor panel.
Utilize a custom package repository
Besides Packagist, you tin can use a custom bundle repository.
-
Inside composer.json, create a repositories department for your repository:
{ "name": "vendor_name/package_name", "repositories": [ { "type": "composer", "url": "https://packages.example.com" } ] }
Later on PhpStorm retrieves the packages information, you can install, update, and uninstall packages every bit usual.
Create and run Composer scripts
With Composer, yous can create and run scripts, which are used for executing some custom code or package-specific commands during the Composer execution process.
Define a Composer script
-
Inside the
scriptsdepartment of composer.json, create an event property, and list the desired scripts inside it. Each script can exist a PHP callback defined every bit a static method, a command-line executable command, or a reference to an existing script.Use code completion Ctrl+Space to get suggestions for event names, classes' and static methods' names, and binaries installed nether vendor/bin. To add a reference to an existing script, prepend it with the
@symbol.
Rename a Composer script
-
Position the caret at a script's definition or usage.
-
Invoke the Rename refactoring past selecting from the principal menu or from the context carte du jour, or press Shift+F6.
-
In the Rename dialog that opens, provide the desired proper name for a script.
-
Click Preview to detect possible changes in the Find tool window. Click Refactor to proceed.
Run a composer script
-
Click
in the gutter next to the script you lot want to execute. From the list, select Run <script name>.
-
Correct-click inside the script you want to run and select Run <script name> from the context card.
-
Position the caret at the script y'all want to execute, press Alt+Enter and select the Run <script name> intention activeness.
When the script is executed, PhpStorm automatically creates a dedicated temporary Composer Script run/debug configuration for it. You lot can salvage information technology as a permanent run/debug configuration if necessary.
Create a Composer script run/debug configuration
You tin execute Composer scripts by using run configurations of the Composer Script type. With the run configuration, you can execute a script at whatever indicate, add together information technology to the Services tool window, or a compound configuration. Refer to Working with Run/Debug Configurations for details.
-
Do any of the following:
-
In the editor, right-click inside the desired script record and select Create <configuration name> from the context menu.
-
Alternatively, choose from the main menu, then click
and cull Composer Script from the list.
-
-
Provide the run/debug configuration parameters:
-
Path to composer.json: in this field, provide the path to composer.json that contains the desired script's definition.
-
Script: from this list, select one of the defined Composer scripts to execute.
-
Control line parameters: in this field, type the additional command line parameters. These parameters volition be passed as CLI arguments to the CLI handlers; inside PHP handlers, they can be retrieved as an array via
$event->getArguments()calls.
-
Relieve a temporary Composer Script run/debug configuration
When you execute a Composer script from the editor, PhpStorm automatically creates a temporary run/debug configuration with the script parameters. A temporary run/debug configuration works the same style every bit a permanent run/debug configuration. You tin change its settings using the Run/Debug Configuration dialog and optionally save it as permanent.
-
In the Run/Debug Configuration selector, cull .
-
In the Run/Debug Configuration dialog, select the configuration and click
.
Execute a Composer script using a run/debug configuration
-
In the Run/Debug Configuration selector, select the desired run configuration. And then click
on the primary toolbar or press Shift+F10.
-
Printing Alt+Shift+F10, select the desired run configuration from the listing, and printing Enter.
View the Composer log
When you execute a Composer-related command via the PhpStorm interface, the command'due south output is displayed in the dedicated Composer Log console:
Open Composer log
-
Having executed whatever Composer command for the first time, click the Show in log shortcut link in the Notifications tool window notification message:
-
Open composer.json in the editor and click the Show Log shortcut link on height of the editor panel.
View the folded Composer Log bulletin
If a Composer command has been executed successfully, Composer Log will fold its execution details.
-
Click
in the gutter to unfold the message.
-
Hover the mouse over the ellipsis to view the message in a tooltip:
When appointing a default composer.json in a project, you tin enable PhpStorm'south settings synchronization with composer.json. Composer Log will highlight such a modify in the settings as information technology occurs. Click in the gutter it to quickly navigate to the corresponding Directories, PHP, Test Frameworks, or PHP command line tools settings pages.
Run additional Composer commands
PhpStorm provides the user interface for a set of additional Composer commands.
-
From the composer.json context bill of fare, select .
-
Open composer.json in the editor, click
on top of the composer.json editor panel, and choose the desired control from the listing.
-
To run a control for the default composer.json, select from the main menu.
If Composer execution is not set up, the Composer Settings dialog will open up, prompting yous to choose how the Composer commands will be executed:
-
To run commands via a globally installed composer executable, cull 'composer' executable and specify its location in the field.
-
To run commands via the local composer.phar annal, cull composer.phar. Then, either specify the location of the existing composer.phar file in the field or select the Download composer.phar from getcomposer.org checkbox to download a new instance of the file. The downloaded composer.phar file will exist saved nether the project root folder.
Then, choose one of the configured local PHP interpreters from the PHP interpreter list. Refer to Configure local PHP interpreters for details.
-
To run commands via a remote interpreter, cull Remote interpreter.
-
From the CLI Interpreter list, select a remote interpreter to use, or click
and configure a new one as described in Configure remote PHP interpreters.
In most cases, PhpStorm detects path mappings automatically. If necessary, you tin click
in the Path mappings field and specify them manually in the Edit Project Path Mappings that opens.
-
In the Composer executable field, provide the name of the Composer executable. You tin click
, and locate the executable in the Select Path On The Server dialog that opens.
-
Validate
Run this control to perform several validity checks against the composer.json file, which is recommended before committing composer.json to a VCS. Validation results are displayed in the Composer Log console.
The equivalent CLI control is validate.
Before executing the command, choose the desired options in the Validation Settings dialog:
-
Allow unbound version constrains: If selected, version constraints without an upper jump (for example
*,>3.ane) will be permitted. Annotation that this will let updates to any future version of a dependency, which may cause astern compatibility issues in the case of unexpected changes in dependencies.The equivalent option of the CLI command is
--no-check-all. -
Check if composer.lock is up-to-date: If selected, the version constraints listed in composer.lock volition be checked against the ones listed in composer.json. If the version constraints exercise not match, it is recommended to fix this by updating packages. After the packages are updated to the required versions, the composer.lock and the composer.json files will be synchronized.
The equivalent option of the CLI command is
--no-bank check-lock. -
Cheque if the package is Packagist-set: If selected, the package'southward composer.json will be checked against the Packagist publishing requirements. Generally, for a bundle to be Packagist-set up, the
name,description, andrequiresections in its composer.json file must be specified. Refer to the Packagist documentation for details on publishing packages.The equivalent pick of the CLI command is
--no-check-publish. -
Validate package dependencies: If selected, the composer.json files of all installed dependencies of the current bundle volition as well be validated.
The equivalent option of the CLI control is
--with-dependencies.
Dump Autoloader
Run this command to generate the listing of autoloaded classes. If the list already exists, it will exist generated anew. This can be useful in situations when you introduce a new grade in a project and demand to include it to the list of autoloaded classes. Refer to the Composer documentation for more details on autoloading classes with Composer.
The equivalent CLI control is dump-autoload.
Before executing the command, cull the desired options in the Autoloader Generation Settings dialog:
-
Skip scripts execution: If selected, the scripts defined in the
scriptsdepartment of the composer.json file are not executed.The equivalent option of the CLI command is
--no-scripts. -
Optimize autoloader (Catechumen PSR-0/iv rules to a classmap): If selected, Composer will browse the given PSR-0/4 autoloading directories/files for the php and inc files and generate a unmarried
autoload_classmapcentral-value assortment to speed upwards autoloading. Note that if the number of classes is large, running this control tin be time-consuming.The equivalent option of the CLI command is
--optimize. -
Autoload classes from the classmap but: If selected, just the classes listed in the class map will be autoloaded. Composer volition not search for fallback PSR-4 directories for classes not listed in the class map. Since this naturally requires an existing class map, Composer will also execute the Optimize autoloader (Convert PSR-0/4 rules to a classmap) command to generate 1, which can be a time-consuming process.
The equivalent option of the CLI command is
--classmap-authoritative. -
Apply APCu for caching found/non-institute classes: If selected, caching via APCu volition be enabled. When a class is found (or not establish) in the class map, the corresponding tape will be cached in APCu, and then that information technology tin be apace retrieved on the next request.
The equivalent option of the CLI control is
--apcu. -
Disable autoload-dev dependencies: If selected, the autoloaded namespaces and files listed in the
autoload-devsection are not included into the autoloaded classes list.The equivalent option of the CLI control is
--no-dev.
Check for Changes in Dependencies
Run this command to check if you lot have any local changes in the code of the package dependencies.
The equivalent CLI control is status.
Articulate Cache
Run this command to delete the Composer's enshroud directory, which contains the downloaded packages. By default, the enshroud directory is ready to C:\Users\<user>\AppData\Local\Composer on Windows, and to ~/.composer/enshroud on Linux and macOS. Refer to the Composer documentation for details.
The equivalent CLI control is clear-cache.
List Licenses
Run this command to view the name, version, and license type of every installed package.
The equivalent CLI command is licenses.
Diagnose
Run this control to perform automatic checks for the most mutual Composer issues (for example connectivity issues, Composer/PHP version used, disk space available, composer.json validity). If the problem is not identified, refer to the Composer troubleshooting guide.
The equivalent CLI command is diagnose.
Simulate Update
Run this command to simulate updating the dependencies without actually running composer update. In doing so, you can verify whether all dependencies are resolved successfully and preview the changes while keeping everything intact.
The equivalent CLI control is update --dry-run.
To retrieve the available packet updates and provide improve coding help in composer.json, PhpStorm runs the update --dry-run command in background every fourth dimension you open a project or modify composer.json. If necessary, you can disable running the command. In the Settings/Preferences dialog (Ctrl+Alt+S), get to and clear the Check for available package updates checkbox.
Cocky-Update
Run this command to update Composer itself (that is, the composer.phar file) to the latest version.
The equivalent CLI control is self-update.
Run Composer from the command line
Command-line mode provides yous with the full range of Composer commands. To utilize Composer in this mode, you lot need to configure it as an external command-line tool. For details on working with command-line tools, refer to PHP command line tools.
Yous can have several instances of Composer configured and switch between them from i project to another past specifying the relevant one during Composer initialization.
Configure Composer equally a control line tool
-
In the Settings/Preferences dialog (Ctrl+Alt+S), get to .
-
Click
on the toolbar.
-
In the Command Line Tools dialog, choose Composer from the listing, and specify its visibility level (Project or Global).
-
When yous click OK, the dialog opens.
Specify how yous want to launch Composer by choose one of the options: composer.phar or php script or composer executable. Depending on your selection, specify the paths to the PHP installation binder and composer.phar or to the composer executable file.
PhpStorm parses the contents of the specified .phar archive or executable file for Composer commands. When the file analysis is completed, PhpStorm returns to the Command Line Tools Support page where the specified file is added to the list of control line tools available in PhpStorm.
-
Click OK to employ changes and return to the Command Line Tool Support page. Optionally, click
to edit the tool properties, or
to customize the commands set. Come across Customize a tool for details.
Run a Composer control
-
From the main menu, choose or press Ctrl twice.
In the Run Annihilation window that opens, type the telephone call of the control in the
<c> <command>format.The command execution result is displayed in the Run tool window.
Terminate a control
-
Click
on the Run tool window toolbar.
Last modified: 13 April 2022
Source: https://www.jetbrains.com/help/phpstorm/using-the-composer-dependency-manager.html
0 Response to "Phpstorm Upload to Zaolivetea.com Failed: Could Not Change to Work Directory /."
ارسال یک نظر