Download the PHP package khalyomede/fetch without Composer

On this page you can find all versions of the php package khalyomede/fetch. 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 fetch

Fetch

PHP from Packagist Packagist Packagist

Quickly retrieve your PHP data.

From

To

Summary

Prerequisites

Installation

In your project folder:

Examples of uses

All the examples below assume we are on the root (inside the index.php file) and we have the following arborescence:

Example 1: fetching a data from a simple file

All the configuration file should return a PHP array.

Let us assume the file app.php contains:

We can fetch the charset using:

This will display

Example 2: fetching a data by traversing multiple folders

All the configuration files should return a PHP array.

Let us assume the file option.php contains:

Will display

Example 3: fetching a data inside nested keys

All configuration files should return a PHP array.

Let us assume the file option.php contains:

Will display:

Example 4: fetching some data using a specific key

All configuration files should return PHP array.

Let us assume the file option.php contains:

Will display:

Example 5: fetching faster using cache

Let us assume a new folder has been created, called cache. Here is the updated arborescence:

The first fetching might be slow, but the subsequent fetches will be much more faster while the cached data is not removed.

Note

This library will not handles the cache removing.

Tips

Think to disable the cache when you are in development mode as your configuration file will changed a lot and might be outdated without updating to the new value. This tips features Laravel 5 debug helper.

Warning

The cache might be outdated if you use it without clearing it after an update of your configuration data.

Example 6: using a function before actually fetching the data

You can apply "middleware" function before fetching/caching the data if needed.

Will display

Note

The anonymous takes only one parameter and it can be frustrating. Use use statement to help you pass more arguments and overcome this constraint:

Will display

Note 2

Once the function is set, it is applyied for any further fetches. If you want to remove the function, you can use uncross() to do so:

Will display

Prototype ready

This class lets you extend its functionality to your needs without having to dive into the source code. For example:

For more information, check khalyomede/prototype documentation.

Methods definitions

construct()

Sets the default folder to fetch the data from.

Exceptions

InvalidArgumentException:

from()

Fetch the data from the given path.

Exceptions

InvalidArgumentException:

UnexpectedValueException:

RuntimeException:

usingCache()

Specify the folder for storing the cached data and enable the cache mode.

Exceptions

InvalidArgumentException:

enableCache()

Enable the cache mode.

disableCache()

Disable the cache mode.

encrypt()

Useful when you need to get the same files name to perform additional processes from a path.

decrypt()

Useful when you want to get the original path used for storing the cached file using the cached file name.

Note

Do not include the file extension (.php) when decrypting using the file name.

across()

Apply a function (which should be an anonymous, i.e. a closure) before fetching or caching the data. The function should have only one parameter, which will be filled with the fetched data.

Exceptions

InvalidArgumentException:

ReflectionException:

uncross()

Removes the previously set function (made by Fetch::across).

MIT Licence

Fetch

Copyright © 2018 Khalyomede

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the oftware, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN CTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of fetch with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.0
khalyomede/prototype Version 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 khalyomede/fetch contains the following files

Loading the files please wait ....