using composer

Discussion in 'Development' started by r7vmc, Oct 21, 2017.

  1. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    is there any tutorials to using composer with pmmp?
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,555
    GitHub:
    muqsit
    You should include the autoloader the composer has generated.
    PHP:
    <?php
    require_once "vendor/autoload.php";
    Then you are good to import your composer libs.
    PHP:
    <?php
    require_once "vendor/autoload.php";

    use 
    my\composer\Library;
     
    jasonwynn10 likes this.
  3. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    How do I make composer generate ?
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,555
    GitHub:
    muqsit
    you don't need to, PocketMine should already do that on startup
     
  5. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    Do you have a example plugin?
     
  6. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,898
    GitHub:
    sof3
    If you want to use composer in your plugin, you should place the composer.json next to your plugin.yml, then composer init before compiling your plugin, then in onLoad() of your plugin, add this line:
    PHP:
    require $this->getFile() . "ventor/autoload.php";
    If you use it with Poggit, you must pre-install it locally, then also push the vendor files to GitHub and tell Poggit to include vendor/ in the compiled phar, because Poggit does not install composer for plugins.
     
    jasonwynn10 and Jack Noordhuis like this.
  7. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    and what should I put in composer.json ?
     
  8. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    can you make full tutorial please?
     
  9. Jack Noordhuis

    Jack Noordhuis Zombie Pigman Poggit Reviewer

    Messages:
    620
    GitHub:
    JackNoordhuis
    Still don't understand why people would want to waste their time waiting for a reply on a forum. A quick Google search could've literally given you hundreds upon thousands of results about composer tutorials.

    You should probably read the composer documentation before you start using it.
     
  10. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    I did a research but I didn't understand anything
     
  11. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,898
    GitHub:
    sof3
    Then you shouldn't be using composer at all.
     
  12. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    I will try to understand it I won't give up already
     
  13. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,898
    GitHub:
    sof3
    The question is, if you don't know what composer is, why do you even say that you want to use composer?
     
  14. r7vmc

    r7vmc Baby Zombie

    Messages:
    112
    GitHub:
    r7vmc
    Yes I know what it is
    And I want to use this Library in my plugin
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.