Download the PHP package krak/php-inc without Composer

On this page you can find all versions of the php package krak/php-inc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-inc

Php Inc

PHP Requirements

Php inc is a composer plugin for automatically including certain files into composer's autoload and autoload-dev files config. Given a set of file matchers, on the the dump-autoload event, php-inc will automatically include any matched files into the dumped autoloaded files.

This ameliorates the issues that come about when you want to include certain files that contain functions or maybe multiple classes but don't want to constantly update the composer autoload files configuration which can get hard to deal with when you start including more files.

Installation

Install via composer at krak/php-inc

Usage

With the default configuration, simply name any file in your src or tests directory starting with a lower case letter with a .php extension will automatically be included in the dumped autoload files when composer's dump-autoload event is triggered. This happens on install, update, or dump-autoload commands.

The composer plugin is automatically loaded after it is installed, so in most scenarios, you shouldn't have to do anything for the files to be automatically included. However, if you add files and want to include them right away during development, you can run composer dump-autoload to make sure they are included.

Configuration

Here's an example of the default configuration that is applied:

Let's go through and explain what each part means and refers to.

src-path

src-path will determine the path to your source code where any autoload files will be searched in.

If you are working with the standard Laravel file structure, you'll want to change the src-path to app instead of src.

test-path

test-path will determine the path to your test code where the autoload-dev files will be searched.

matches

matches can be any hierarchy of configured matches to determine how you want the src folder to be searched for files to be included in autoload.files. The default configuration ensures that all files that start with a lower case file name, have a php extension, and are not inside of a Resources or Tests directory will be included in the autoload.files composer configuration.

matches-dev-src

matches-dev-src can be any hierarchy of configured matches to determine how you want the src folder to be searched for files to be included in autoload-dev.files. The default configuration ensures that all files that start with a lower case file name, have a php extension, are inside of a Tests directory, and not apart of a Fixtures directory will be included in the autoload-dev.files composer configuration.

matches-dev-test

matches-dev-test can be any hierarchy of configured matches to determine how you want the test folder to be searched for files to be included in autoload-dev.files. The default configuration ensures that all files that start with a lower case file name, have a php extension, and are not apart of a Fixtures directory will be included in the autoload-dev.files composer configuration.

Debugging

If you are ever curious what files are being included, you can simply run composer dump-autoload -v and view the php-inc output to see which files are being merged with which composer files definition.

Managing Dependencies

With extended use, you may come into a situation where one file included needs to be loaded before another. If this comes up, the best solution I've found for now is to prefix those files with an _ and just create a new file named inc.php which loads them in the correct order.

For example:

a.php depends on b.php loading first. To enforce loading order, we'd make the following change:

Where inc.php is as follows:

When you run composer dump-autoload, only inc.php will be included and will make sure to include those files correctly.

Why is this useful?

https://nikic.github.io/2012/08/10/Are-PHP-developers-functophobic.html

Until php includes a spec for function autoloading, creating and using standard functions within a modern psr-4 codebase is cumbersome, especially compared to the simplicity of using autoloaded classes. Most devs will give up on using functions and just create abstract classes with static functions to circumvent the autoloading constraints instead of manually registering individual files in the composer autoload sections.

This is useful for more than just functions however. There are plenty of cases where one file with multiple definitions would make sense to keep together instead of splitting into several files which clutter the filesystem.

This plugin is an attempt to help php devs who use composer to have the ability to

Drawbacks

The main drawbacks to automatically including the php files in the composer autoload files section is that those files will be included anytime the composer autoloader is loaded. In larger projects, this can be a concern if you are loading files that are only needed during certain, less frequent paths of execution.

Opcache does mitigate this problem tremendously, but it is something to consider when you start sprinkling files to be included throughout your codebase.


All versions of php-inc with dependencies

PHP Build Version
Package Version
Requires composer-plugin-api Version ^1.1 || ^2.0
php Version ^7.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package krak/php-inc contains the following files

Loading the files please wait ....