1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Using custom classes in /src

Discussion in 'Development' started by Aeternus, Aug 11, 2017.

  1. Aeternus

    Aeternus Creeper

    Messages:
    3
    GitHub:
    infernituum64
    Hello, friends! I have plugin and PHP library named RedBeanPHP (redbeanphp.com). I need to connect this library to my plugin class, but BaseClassLoader don't find the class R (see on the screenshots). Can you help me? :)

    P.S Sorry for my english, i'm from Germany.
     

    Attached Files:

  2. Eduardo

    Eduardo Baby Zombie

    Messages:
    100
    GitHub:
    xBeastMode
    Where is the `rb.php` file located in your server?
     
  3. Aeternus

    Aeternus Creeper

    Messages:
    3
    GitHub:
    infernituum64
    In the folder where the main plugin class is located
     

    Attached Files:

    • db.zip
      File size:
      85.2 KB
      Views:
      4
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    you need to shade the lib namespaces
    into (basenamespace)/(original namespace)
    the R class is not found thus the error
    also try not to use forks, most people here dont like it
     
  5. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Refactor the library such that the classes declared by the library are you going n your plugin namespace, as stated in PQRS v1.1 section 1. If it's too inconvenient for you, fork and convert the library into a virion.
    If you insist to include the file directly, use an absolute path:
    PHP:
    require_once $plugin->getFile() . "/src/rb.php";
     
    jasonwynn10 likes this.
  6. Aeternus

    Aeternus Creeper

    Messages:
    3
    GitHub:
    infernituum64
    How to convert library to virion? Can you explain for me?
     
  7. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    There is no direct "convert" button. You may consult the Virion Documentation at https://poggit.pmmp.io/virion for reference on how to develop a virion.
     
    jasonwynn10 likes this.
  8. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    An ORM in PM? Sounds sick :p
     
  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.