NetBeans with Composer and Packagist the PHP Package Manager

Last Updated : |  

Most people probably already know the JavaScript Package Manager NPM Node Package Manager, because it is very widespread. This idea was also used to develop a package manager for PHP, called itself  Packagist and is used with Composer. We can do that  Composer Install globally and integrate into NetBeans so that we can serve them via dedicated interfaces.

So here you will learn how to implement this, I'll tell you step by step how to do it the easiest and fastest. You can also create a scaffolding with PHP as with JavaScript, but there are ways to use the console. But I'll go into this topic another time, so let's start with the tutorial.



Install Composer

We need the first  composer.phar which we enter in NetBeans the path, so Download the composer.phar in a folder outside of your projects. We make it available globally and can use it in any project without downloading composer.phar every time. But do not forget to update of course if there is a newer version;) You can download it programmatically or manually, in the link above you will find the manual download below.

This is currently the current version, upload it if you want here  composer.phar 1.8.4 Download down.



Integrate with Netbeans

NetBeans Composer Packagist Tutorial

So, if we placed the composer.phar outside of our projects, we open NetBeans and go to Settings (Prefrences) -> PHP -> Frameworks & Tools -> Composer. Here we carry the path to our composer.phar and the other details, such as the vendor folder, author, author mail, and the versioning option. After we have confirmed these settings, we can now use the Composer over the surfaces.



Install repos with Composer

Composer Tutorial Settings Usage

We need a composer.json to specify our repos to download. We want to use certain repos and we can find them on Packagist and can specify them in our compsoer.json. What could look like this.


// JSON CODE
     0  {  1      "name": "my-project",  2      "autoload": {  3          "psr-4": { "Syn\\": "src/" }  4      },  5      "autoload-dev": {  6          "psr-4": { "Syn\\": "tests/" }  7      },  8      "require": {  9          "php": ">=7.0",  10          "prod3v3loper/syntaxo": ">=1.0"  11      },  12      "require-dev": {  13          "phpunit/phpunit": "^7"  14      }  15  } 

    Of course you can also use the console (terminal) to install the packages.

    Your Comment

    * This fields are required, email don't publish
    You can use this tags: <p>, <em>, <strong>, <u>, <s>, <pre>, <blockquote>
    ?

    This field is optional
    Fill this field link your name to your website.

    Data entered in this contact form will be stored in our system to ensure the output of the comment. Your e-mail address will be saved to determine the number of comments and for registration in the future

    I have read the Privacy policy and Terms. I Confirm the submission of the form and the submission of my data.
    tnado © 2019 | All Rights Reserved
    In cooperation with Hyperly