PHP Classes

Importer: Load classes, images, CSS and JavaScript

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 95 All time: 9,876 This week: 47Up
Version License PHP version Categories
importer 1.1.5Artistic License5HTML, PHP 5, Language
Description 

Author

This package can be used to load classes, images, CSS and JavaScript.

It provides an autoloader that can load classes either from local directories or remote servers passing a given base URL to load classes files.

The package can also load JavaScript, CSS and images from a local directory or a remote server to be used in the current Web page.

Versions of this package for JavaScript and Python are also provided.

Picture of Nikos M.
Name: Nikos M. <contact>
Classes: 18 packages by
Country: Greece Greece
Innovation award
Innovation award
Nominee: 7x

Winner: 2x

 

Example

<?php
require( '../src/php/Importer.php' );

echo(
'Importer.VERSION = ' . Importer::VERSION . PHP_EOL);

echo(
'Importer.BASE = ' . Importer::$BASE . PHP_EOL);

function
console_log()
{
   
$args = func_get_args();
    echo (
'Callback'.PHP_EOL);
   
print_r($args);
}

$importer = Importer::_( dirname(__FILE__), 'http://_mygit/Importer/test/' )
    ->
register('classes', array(

     array(
'Test1', 'Test1', './classes/Test1.php')

    )
/*global ctx*/)
    ->
register('classes', array(

    array(
'Test2', 'Test2', './classes/Test2.php', array('Test1'))

    ),
'my-ctx')
    ->
register('assets', array(

     array(
'styles', 'asset1', './assets/asset1.css')
    ,array(
'styles', 'asset2', './assets/asset2.css', array('asset1'))

    )
/*global ctx*/)
    ->
register('assets', array(

    array(
'styles', 'asset3', array('/* asset 3 */'), array('asset1','asset2'))

    ),
'my-ctx')
    ->
on('import-class-Test2', 'console_log', 'my-ctx')
;


$importer->load('Test2', 'my-ctx');

echo
$importer->get('./classes/Test1.php') . PHP_EOL;
$importer->enqueue('styles', 'asset3', 'my-ctx');
echo(
$importer->assets('styles', 'my-ctx'));


Details

Importer

Importer, a simple &amp; flexible loader manager for namespaces (psr-4, psr-0), classes &amp; assets with dependencies for PHP, Python, Javascript

Importer

see also:

  • ModelView a simple, fast, powerful and flexible MVVM framework for JavaScript
  • tico a tiny, super-simple MVC framework for PHP
  • LoginManager a simple, barebones agnostic login manager for PHP, JavaScript, Python
  • SimpleCaptcha a simple, image-based, mathematical captcha with increasing levels of difficulty for PHP, JavaScript, Python
  • Dromeo a flexible, and powerful agnostic router for PHP, JavaScript, Python
  • PublishSubscribe a simple and flexible publish-subscribe pattern implementation for PHP, JavaScript, Python
  • Importer simple class &amp; dependency manager and loader for PHP, JavaScript, Python
  • Contemplate a fast and versatile isomorphic template engine for PHP, JavaScript, Python
  • HtmlWidget html widgets, made as simple as possible, both client and server, both desktop and mobile, can be used as (template) plugins and/or standalone for PHP, JavaScript, Python (can be used as plugins for Contemplate)
  • Paginator simple and flexible pagination controls generator for PHP, JavaScript, Python
  • Formal a simple and versatile (Form) Data validation framework based on Rules for PHP, JavaScript, Python
  • Dialect a cross-vendor &amp; cross-platform SQL Query Builder, based on GrammarTemplate, for PHP, JavaScript, Python
  • DialectORM an Object-Relational-Mapper (ORM) and Object-Document-Mapper (ODM), based on Dialect, for PHP, JavaScript, Python
  • Unicache a simple and flexible agnostic caching framework, supporting various platforms, for PHP, JavaScript, Python
  • Xpresion a simple and flexible eXpression parser engine (with custom functions and variables support), based on GrammarTemplate, for PHP, JavaScript, Python
  • Regex Analyzer/Composer Regular Expression Analyzer and Composer for PHP, JavaScript, Python

  Files folder image Files (23)  
File Role Description
Files folder imagesrc (3 directories)
Files folder imagetest (7 files, 4 directories)
Accessible without login Image file importer.jpg Icon Icon image
Accessible without login Plain text file README.md Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:95
This week:0
All time:9,876
This week:47Up