Composer package

Dear everbody.

While working with the APi it is needed to create the PHP code that can consume the API.
By doing so, the developer has to make sure he/she creates all the well thought of code to
make this happen. Why invent the wheel twice?

In PHP we use a package manager name Composer. It is used to handle project dependencies.
There are a ton of PHP libraries, frameworks, and components to choose from. Your project will likely use several of them — these are project dependencies. Until recently, PHP did not have a good way to manage these project dependencies. Even if you managed them manually, you still had to worry about autoloaders. No more.

Currently there are two major package management systems for PHP - Composer and PEAR. Which one is right for you? The answer is both.

  • Use [B]Composer[/B] when managing dependencies for a single project.
  • Use [B]PEAR[/B] when managing dependencies for PHP as a whole on your system.
In general, Composer packages will be available only in the projects that you explicitly specify whereas a PEAR package would be available to all of your PHP projects. While PEAR might sound like the easier approach at first glance, there are advantages to using a project-by-project approach to your dependencies.

Composer is a brilliant dependency manager for PHP. List your project’s dependencies in a composer.json file and, with a few simple commands, Composer will automatically download your project’s dependencies and setup autoloading for you.

There are already a lot of PHP libraries that are compatible with Composer, ready to be used in your project. These “packages” are listed on Packagist, the official repository for Composer-compatible PHP libraries.

Source: http://www.phptherightway.com/#dependency_management

Companies like Facebook and thousands of other companies understand that when it comes
to developing, you do not need to invent the wheel for a second time. Therefore they released
their API and a Composer package. (The SDK can be found here and there are some docs with it. https://github.com/facebook/facebook-php-sdk);
The composer package is a wrapper around the Facebook SDK and allows us to easily start developing on the Facebook platform.

Because composer is defacto, I would like to see a official composer package from Interworx.

Why this is handy and needed:

  • Interworx API will be easier to consume
  • The package is the same for everybody, so support can be better
  • Github users can help build and improve
  • Code that communicates with the API will be the same for everybody
  • Building a Interworx dashboard in PHP project can start straight away

How this would work is:

Create a composer.json file when starting a php project. And add this:


require {    "interworx/rest-api": "1.1.*" }

Then you could use it some what like this:


<?php      
use InterworxAPI;     

class InterworxApiController 
{         

    $protected $api = null;         

    public function __construct()        
    {  
               $this->api = new InterworxAPI('yourdomain.com','99KCpD0HfLcy3iaRP0Hb4vtbAS8jbrEq');         
    }
         
    public function listResellers()        
    {
            // return nice JSON            
            return $this->api->listResellers();                   
    }        

}


So I would like to know if there are any plans on releasing a Composer package soon?

Some extra reference:
Dependency management: http://www.phptherightway.com/#dependency_management
Rise of composer: http://fabien.potencier.org/article/72/the-rise-of-composer-and-the-fall-of-pear

Hi netbulae

I hope you don’t mind and I’ve read your post, thought about and I could be wrong sorry, but could you not start your own using besoap simple with wdsl.

As interworx does not include the OS, you should be able to install composer on your server and the php ini is well documented.

I’m sorry if I’m wrong and I do think it has interesting possibilities.

Many thanks

John

Hi there, thanks for the reply. Sorry, but I think you didn’t get it.

  1. I’m sorry, but I really need to tell you that talking about ‘Interworx does not include the OS’, does not make any sense :slight_smile:
  2. And ofcourse composer can be installed on any server. That is never been an issue.

Please read it again and try to understand what a composer package is and how the php community are using them.

Creating a package is creating an easy to use library, which can be pulled in any PHP project.
Developers can pull it in, add their API key and BOOM!! Start developing a cool dashboard or whatever.

When there is no package… developers first need to go through the whole API, then create functionality to talk with
the API and after a lot of wasted time…finally can start developing.

You see that it can speed up the fun for everyone?

-edit- If you have any questions, I’d like to go deeper in to it.

I second the montion for a composer package for Interworx.

We have for instance discussed building a Laravel based project that would communicate with our interworx cp’s.
Having a composer package available would make implementation a lot easier.

We have for instance discussed building a Laravel based project that would communicate with our interworx cp’s.

Great, I have been building a lot of Laravel based systems myself.

The best thing of a composer package, is that it can be used in all composer based php frameworks. It should be framework agnostic.

Yea, it’s becoming the standard in the industry.
Symfony, Laravel, Zend (!) & Slim to name a few, use composer for their dependency management.
And projects like Bootstrap, Uikit (getuikit.com), doctrine, phpunit distribute composer based packages.
Service providers like AWS, paypal, Stripe & mailchimp, have released composer based SDKs to help developers integrate their services in projects.

It has been the standard for a long time now, but there are a lot of old sites that can not use it yet.
All sites that are being developed right now use composer.

I have already sent an email to the Interworx support mail and at first they didn’t understand me. It’s sad how some people are totally decoupled from todays technology changes. But then the support guy told me that he will send the request to the development team. So I keep my fingers crossed and hope that there are some people who understand the importance of it.
The same goes for SOAP API’s. Those things are just so damn frustrating and old. The dinosaur of the industry. It’s all REST now.
There should always be an REST API with a composer package…and if there is a SOAP API…there should DEFINITELY be a composer package :slight_smile:

But I love Interworx, it is the best thing in hosting land. And I know for sure that they will boot a github repository soon and start developing a composer package, because Interworx claims: “WE LOVE DEVELOPERS <3”. And I’m certain that this love is true…
The community will step in to help when development is started. I will fork it and join the fun.