Closed snrsamy closed 10 years ago
You should be using an autoloader rather than manually requiring things. Try this instead:
Create a composer.json
file in your project root:
{
"require": [
"ruler/ruler": "v0.2.0"
]
}
composer install
or php composer.phar install
require 'vendor/autoload.php';
to your app instead of all those manual requires and includesJustin,
Thanks for the suggestion. I downloaded the composer but due to firewall, could not get the packages installed. Is there an option to configure the packages to be picked up from a local folder.
Thank you,
Sam. On Dec 14, 2013 11:10 AM, "Justin Hileman" notifications@github.com wrote:
You should be using an autoloader rather than manually requiring things. Try this instead:
1.
Install Composer http://getcomposer.org 2.
Create a composer.json file in your project root:
{ "require": [ "ruler/ruler": "v0.2.0" ] }
3.
Run composer install or php composer.phar install 4.
Add require 'vendor/autoload.php'; to your app instead of all those manual requires and includes 5.
Win!
— Reply to this email directly or view it on GitHubhttps://github.com/bobthecow/Ruler/issues/21#issuecomment-30581007 .
You can use any PSR-0 compatible autoloader ... composer happens to be the easiest one to get set up, but there are others:
I'm assuming by now you figured out a class loader that worked for you?
Following are the changes made to Context.php, Pimple.php and application: But still failing as: PHP Fatal error: Class 'Context' not found in line number new Context
Follwoing changes in Context: Added required once for Pimple Removed backslash on Pimple extends
namespace Ruler; require_once("....../Ruler/Pimple.php");
/**
Follwoing changes in Pimple Added namespace Added backslash on ArrayAccess implements
namespace Ruler; /**
Following is change in application php:
include("Ruler/RuleBuilder.php"); include("Ruler/Variable.php"); include("Ruler/RuleBuilder/Variable.php"); include("Ruler/Proposition.php"); include("Ruler/Rule.php"); include("Ruler/Operator/ComparisonOperator.php"); include("Ruler/Operator/NotEqualTo.php"); //include("Ruler/Pimple.php"); require("Ruler/Context.php"); use Ruler\RuleBuilder; use Ruler\Operator;
Please help.