Code Monkey home page Code Monkey logo

Comments (6)

allejo avatar allejo commented on June 22, 2024

To narrow down the issue, I'd need a bit more information.

  1. Are you using Composer in your project?
  2. Are you using an autoloader (e.g. Autoload) in your project to automatically include all of the PhpSoda files in your project so you may access its classes?
  3. Are you manually include'ing the necessary PhpSoda classes so you may access its classes?

from phpsoda.

mmkbennani avatar mmkbennani commented on June 22, 2024

Excuse me.

I don't know how to use the php libray!!

How to use sodaclient?

Is there a concret example?

Best regards.
Le 11 juil. 2015 17:26, "Vladimir Jimenez" [email protected] a
écrit :

To narrow down the issue, I'd need a bit more information.

  1. Are you using Composer https://getcomposer.org/ in your project?
  2. Are you using an autoloader (e.g. Autoload
    https://github.com/theseer/Autoload) in your project to
    automatically include all of the PhpSoda files in your project so you may
    access its classes?
  3. Are you manually include'ing the necessary PhpSoda classes so you
    may access its classes?


Reply to this email directly or view it on GitHub
#1 (comment).

from phpsoda.

allejo avatar allejo commented on June 22, 2024

It seems you're trying to use the library without Composer handling the autoloading of classes nor are you using an autoloader, which isn't really supported because better practices exist. To solve this, you're going to need have an autoloader to handle files. I've generated an autoload.php file below and you need to put this file inside of the src folder inside of PhpSoda.

Your file structure would look like this:

|- Socrata
   |- PhpSoda
      |- src
         - autoload.php
    - index.php

PhpSoda/src/autoload.php

<?php
// @codingStandardsIgnoreFile
// @codeCoverageIgnoreStart
// this is an autogenerated file - do not edit
function autoloadb1fb9576f6a44a390729a4572cbb3669($class) {
    static $classes = null;
    if ($classes === null) {
        $classes = array(
            'allejo\\socrata\\converters\\converter' => '/Converters/Converter.php',
            'allejo\\socrata\\converters\\csvconverter' => '/Converters/CsvConverter.php',
            'allejo\\socrata\\exceptions\\curlexception' => '/Exceptions/CurlException.php',
            'allejo\\socrata\\exceptions\\filenotfoundexception' => '/Exceptions/FileNotFoundException.php',
            'allejo\\socrata\\exceptions\\httpexception' => '/Exceptions/HttpException.php',
            'allejo\\socrata\\exceptions\\invalidresourceexception' => '/Exceptions/InvalidResourceException.php',
            'allejo\\socrata\\exceptions\\sodaexception' => '/Exceptions/SodaException.php',
            'allejo\\socrata\\sodaclient' => '/SodaClient.php',
            'allejo\\socrata\\sodadataset' => '/SodaDataset.php',
            'allejo\\socrata\\soqlorderdirection' => '/SoqlOrderDirection.php',
            'allejo\\socrata\\soqlquery' => '/SoqlQuery.php',
            'allejo\\socrata\\utilities\\stringutilities' => '/Utilities/StringUtilities.php',
            'allejo\\socrata\\utilities\\urlquery' => '/Utilities/UrlQuery.php'
        );
    }
    $cn = strtolower($class);
    if (isset($classes[$cn])) {
        require dirname(__FILE__) . $classes[$cn];
    }
}
spl_autoload_register('autoloadb1fb9576f6a44a390729a4572cbb3669');
// @codeCoverageIgnoreEnd

Then, in your index.php file you will need to include the autoload file and then you'll be able to use the namespace.

index.php

<?php

include("PhpSoda/src/autoload.php");

use allejo\Socrata\SodaClient;

$sc = new SodaClient("http://opendata.socrata.com");

from phpsoda.

mmkbennani avatar mmkbennani commented on June 22, 2024

Hi Sir

Thats work very gooood

Thanks a lot :)

2015-07-11 22:36 GMT+00:00 Vladimir Jimenez [email protected]:

It seems you're trying to use the library without Composer handling the
autoloading of classes nor are you using an autoloader. To solve this,
you're gonna need have an autoloader to handle files. I've generated an
autoload.php file below and you need to put this file inside of the src
folder inside of PhpSoda.

Your file structure would look like this:

|- Socrata
|- PhpSoda
|- src
- autoload.php
- index.php

PhpSoda/src/autoload.php

'/Converters/Converter.php', 'allejo\socrata\converters\csvconverter' => '/Converters/CsvConverter.php', 'allejo\socrata\exceptions\curlexception' => '/Exceptions/CurlException.php', 'allejo\socrata\exceptions\filenotfoundexception' => '/Exceptions/FileNotFoundException.php', 'allejo\socrata\exceptions\httpexception' => '/Exceptions/HttpException.php', 'allejo\socrata\exceptions\invalidresourceexception' => '/Exceptions/InvalidResourceException.php', 'allejo\socrata\exceptions\sodaexception' => '/Exceptions/SodaException.php', 'allejo\socrata\sodaclient' => '/SodaClient.php', 'allejo\socrata\sodadataset' => '/SodaDataset.php', 'allejo\socrata\soqlorderdirection' => '/SoqlOrderDirection.php', 'allejo\socrata\soqlquery' => '/SoqlQuery.php', 'allejo\socrata\utilities\stringutilities' => '/Utilities/StringUtilities.php', 'allejo\socrata\utilities\urlquery' => '/Utilities/UrlQuery.php' ); } $cn = strtolower($class); if (isset($classes[$cn])) { require dirname(**FILE**) . $classes[$cn]; }}spl_autoload_register('autoloadb1fb9576f6a44a390729a4572cbb3669');// @codeCoverageIgnoreEnd Then, in your index.php file you will need to include the autoload file and then you'll be able to use the namespace. _index.php_

KELLA BENNANI Mohamed El-Mekki

Ingénieur d’état Système d'Information Géographique (SIG)

E.H.T.P

Tel : (00212) 655-252-062

from phpsoda.

allejo avatar allejo commented on June 22, 2024

No problem!

from phpsoda.

allejo avatar allejo commented on June 22, 2024

PhpSoda is now also distributed as a Phar file which can be used as a simple include or require in a PHP script.

Take a look at the wiki article which also contains an example.

from phpsoda.

Related Issues (7)

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.