Git Product home page Git Product logo

f3-lib's Introduction

f3-lib

A library for the F3 framework a link, The library is designed to use fatfree as a strong base, and add on top it the files and functions to quickly create applications. There is a strong community of apps, for solving common problems.

The Library is standalone and be quickly added to your repo using composer

Add this to your project's composer.json file:

{
    "require": {
        "dioscouri/f3-lib": "dev-master"
    }
}

Then add the following two lines to your index.php file, immediately before $app->run();

// bootstap each mini-app
\Dsc\Apps::instance()->bootstrap();

// trigger the preflight event
\Dsc\System::instance()->preflight(); 

Example index.php file

<?php
//AUTOLOAD all your composer libraries now.
(@include_once (__dir__ . '/../vendor/autoload.php')) OR die("You need to run php composer.phar install for your application to run.");
//Require FatFree Base Library https://github.com/bcosca/fatfree
$app = Base::instance();
//Set the PATH so we can use it in our apps
$app->set('PATH_ROOT', __dir__ . '/../');
//This autoload loads everything in apps/* and 
$app->set('AUTOLOAD',  $app->get('PATH_ROOT') . 'apps/;');
//load the config files for enviroment
require $app->get('PATH_ROOT') . 'config/config.php';
//SET the "app_name" or basically the instance so we can server the admin or site from same url with different loaded classes
$app->set('APP_NAME', 'site');
if (strpos(strtolower($app->get('URI')), $app->get('BASE') . '/admin') !== false)
{
    $app->set('APP_NAME', 'admin');
    //stupid javascript bugs with debug off
    $app->set('DEBUG', 1);
}
// bootstap each mini-app  these are in apps folder, as well as in vender/dioscouri
\Dsc\Apps::instance()->bootstrap();
// load routes; Routes are defined by their own apps in the Routes.php files
\Dsc\System::instance()->get('router')->registerRoutes();
// trigger the preflight event PreSite, PostSite etc
\Dsc\System::instance()->preflight();
//excute everything.
$app->run();

apps

The library is designed to bootstrap "apps" apps are just a group of code that bundles features, example, f3-blog will give you a simple blogging platform to your application.

Your, Theme, and custom site would be built to your needs as custom apps.

a default folder structure is like this

/apps /config /public /tmp

your index.php files lives in public, as public is the only web accessible folder.

[TODO ] detail how to build custom apps

THEME

DETAIL CUSTOM THEMES

WEB SERVERS

add configs to NGINX AND APACHE

f3-lib's People

Contributors

rdiaztushman avatar chrisfrench avatar formaktiv avatar

Stargazers

mv avatar Sergey Petrenko avatar oppo salo avatar sheyi avatar  avatar Lubomir Panak avatar  avatar Frank avatar Christian Knuth avatar

Watchers

 avatar James Cloos avatar  avatar  avatar Lukas Polak avatar Vadim Kalosha avatar  avatar

f3-lib's Issues

Add Settings to each mini-app

Since each mini-app has its own bootstrap file, the bootstrap file can be responsible for adding the app's config settings to the \Base::instance()

So where necessary, add a Settings menu item to each mini-app, write the settings to the app's own config file (or store in jig, i don't care), and make the bootstrap file load the settings

Decouple \Dsc\Flash from the SESSION

It prevents the storage of database items that may contain binary data when you're using Mongo (and perhaps other engines) as the session store

Get rid of old traits

There is a few old traits for old models and controllers using them. I think we should delete them during another clean up phase.

Run custom script after composer install

I was thinking of the install situation and I found that composer can run a static php function

so we could do something like

"post-install-cmd": "Dsc\installer::install"

which could create all the folders and stuff that might be needed.

debug \Dsc\Bootstrap::preSite (and maybe other methods)

It looks like at least the preSite() method is triggered more than once for each app. Here's how you can replicate the issue:

  1. Edit any of the bootstrap files for any of the apps.
  2. add a preSite() method if it doesn't already have one
  3. set the content of preSite() to output something, such as
\Dsc\System::addMessage( \Dsc\Debug::dump( 'this is the XXXX app') );
  1. refresh your front-end

You will see the message multiple times. Why is that happening? If we're bootstrapping the apps multiple times each page load and/or triggering these methods multiple times per page load, we're creating useless overhead...

Reordering seems broken

Internal Server Error

Argument 1 passed to Admin\Controllers\Menu::doMoveUp() must be of the type array, object given, called in /var/www/buildingbermsgroup.com/vendor/dioscouri/f3-lib/src/Dsc/Traits/Controllers/OrderableItemCollection.php on line 21 and defined

• /var/www/buildingbermsgroup.com/vendor/dioscouri/f3-admin/src/Admin/Controllers/Menu.php:84 Base->{closure}()
• /var/www/buildingbermsgroup.com/vendor/dioscouri/f3-lib/src/Dsc/Traits/Controllers/OrderableItemCollection.php:21 Admin\Controllers\Menu->doMoveUp()
• /var/www/buildingbermsgroup.com/vendor/bcosca/fatfree/lib/base.php:1294 Base->call()
• index.php:37 Base->run()

atleast in navigation but since it is a trait I am putting the ticket here

Assets File Encoding

I think we are returning all images as jpegs regardless of what they are uploaded as.

I think maybe we need to store the image type in the document?

Busy on something else now will come back to this

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.