Composer + F3 is now working!

426 views
Skip to first unread message

Sascha

unread,
Mar 18, 2015, 5:10:46 PM3/18/15
to f3-fra...@googlegroups.com
A few weeks ago, Bong seperated the formerly "lib" folder into its own project on Github. This led to an issue with people using composer. I thought we already fixed that. Unfortunately, the package is not available on packagist.org.

I fixed that by re-adding it. Instead of installing "fatfree" via composer, you have to install "fatfree-core".


I tested it with this simple script which already failed, if you installed F3 via "fatfree".

<?php


include
'vendor/autoload.php';


$app
= Base::instance();


$app
->route('GET /', function() {
        echo
"hello world";
});


$app
->run();

Message has been deleted

er...@digital-garage.com.au

unread,
Dec 14, 2015, 5:54:54 PM12/14/15
to Das Licht via Fat-Free Framework
Hi Das,
 
Possibly the double require.
 
You're requiring you're vendor/autoload but then requiring lib/base.  It looks like you've installed FF via composer (it's in the vendor dir) which means it would be included in the first require.
 
You need to replace your second require with
 
$f3 = \Base::instance();
 
Eric.
 
 
On Tue, Dec 15, 2015, at 02:28 AM, Das Licht via Fat-Free Framework wrote:
 
Hi, 
when I install F3 using composer and add the following code to my index.php I get:
 


<?php

require "vendor/autoload.php";

$f3 = require('vendor/bcosca/fatfree/lib/base.php');
$f3->set('DEBUG',3);

$f3->run();


 

Internal Server Error

Fatal error: Cannot redeclare class Cache


Idea?


--
You received this message because you are subscribed to the Google Groups "Fat-Free Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
 

tom chris

unread,
Dec 28, 2015, 7:30:41 AM12/28/15
to Fat-Free Framework
F3 is Working fine with Composer no Problem at all.

It because you're using it not correctly.

COMPOSER.json

{
   
"name": "bcosca/fatfree",
   
"description": "A powerful yet easy-to-use PHP micro-framework designed to help you build dynamic and robust Web applications - fast!",
   
"homepage": "http://fatfreeframework.com/",
   
"license": "GPL-3.0",
   
"require": {
       
"php": ">=5.3.6",
       
"google/recaptcha": "^1.1"
   
},
   
"repositories": [
       
{
           
"type": "vcs",
           
"url": "https://github.com/bcosca/fatfree"
       
}
   
],
   
"autoload": {
       
"classmap" :[
       
"app/models/",
       
"app/controller/"
       
],
       
"files": [
       
"lib/base.php",
       
"app/functions.php"
       
]
   
}
}


Index.php

<?php
require_once
("../vendor/autoload.php");

$f3
= Base::instance();

$f3
->config("../app/config.ini");
$f3
->config('../app/routes.ini');

$f3
->run();


Reply all
Reply to author
Forward
0 new messages