Code Monkey home page Code Monkey logo

Comments (2)

peter279k avatar peter279k commented on August 17, 2024

As far as I know, this package doesn't support installing without composer.

If you want to install this package without composer, you may use following PHP code snippets.

And these code snippets will help you to load IPInfo classes manually.

<?php
/**
 * This is the bingo-functional autoloader.
 *
 * @param string $class The fully-qualified class name.
 *
 * @return void
 */
spl_autoload_register(function ($class) {

    // project-specific namespace prefix
    $prefix = 'ipinfo\\ipinfo\\';

    // base directory for the namespace prefix
    $baseDir = __DIR__.'/src/';

    // does the class use the namespace prefix?
    $len = strlen($prefix);
    if (strncmp($prefix, $class, $len) !== 0) {
        // no, move to the next registered autoloader
        return;
    }

    // get the relative class name
    $relativeClass = substr($class, $len);

    // replace the namespace prefix with the base directory, replace namespace
    // separators with directory separators in the relative class name, append
    // with .php
    $file = $baseDir.str_replace('\\', '/', $relativeClass).'.php';

    // if the file exists, require it
    if (file_exists($file)) {
        require $file;
    }
});

from php.

peter279k avatar peter279k commented on August 17, 2024

Once using this manual autoload that I mention on previous discussion, it will be worked fine to load IPinfo classes.

But the Class 'GuzzleHttp/Client' not found will be thrown.

You have to handle manual "third-party" loader and it will be very complicated and frustrated.

IMHO, using the composer autoloader directly instead to avoid these issues.

from php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.