Download the PHP package artinict/laravel-customs without Composer

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

Laravel Customs Logo

Laravel Customs

LaravelCustoms (LC) is a package that provides a cleaner way to import your classes and third-party packages. You can think of it this way: Composer manages your dependencies, Customs regulates your imports.

LC uses a concept known as IOCA (Import Once Call Anywhere).

If you don't want to use this concept, LC will automatically import the class on the fly. (See "Automatic Resolving" below)

Table of Contents

  1. Installation
  2. Usage
  3. Import Once Call Anywhere (IOCA)
  4. Customs Configuration
  5. Auto Resolve
  6. Credits
  7. License

Installation

If the installation was successful, a will be created in the Laravel's directory.

NB: If you don't find the in , copy the in the to
Or:
Import LaravelCustoms at the top of any of your classes and run the app. Now check directory for

Usage

Import as at the top of your class.

Then you can access the instance like so:

The general syntax is . Below is how you would use in a real project.

Typically, you would do this:

But now, with LaravelCustoms, you don't have to import mulitple classes anymore. Instead you would import a single class like so:

OK! So i'm sure you're probably wondering why we still had to write . Well, technically, we didn't write that line of code. Laravel did that for us when we ran the command, .

As a rule of thumb, LaravelCustoms should not replace the default class imports written by Laravel.

Ok! So what about ?! Unfortunately, LC cannot support Dependency Injection (DI) as at v2.1😬

General usage with examples:

  1. For non-static methods:
    LC::Prefix_Classname(['methodName'], [args]);

  2. For static methods, put at the front of the methodName:
    LC::Prefix_Classname(['::methodName'], [args]);

  3. Calling a non-static method without "Prefix":
    LC::Classname(['methodName'], [args]);

  4. To get a non-static property of a class:
    $classInstance = LC::Classname();
    $property = (new $classInstance)->propertyName;

  5. To get a static property of a class:
    LC::Classname()::$staticProperty;

  6. Finally, if you don't pass any argument, LaravelCustoms will return the class path.

Import Once Call Anywhere (IOCA)

One of the objectives of LaravelCustoms is to get rid of having to repeatedly import classes everytime you need them. LC provides a cleaner way to do this by using a new concept known as IOCA (Import Once Call Anywhere).

In the customs configuration file provided (See next section). Define your imports like so:

Import using Alias

Alias is a simple way to import classes. This is perfect for your Models and other classes that are likely not to have a classname clash.

For example, can be imported as:

And this would be called as .

Import using prefix

Prefix is a cleaner way to import classes. It groups a set of classes into a category (called Prefix). This helps to mitigate classname clashes.

For example, can be imported as:

And this would be called as .

Customs Configuration

When you install the LaravelCustoms package, a will be created in the Laravel's directory. This is where you would import your classes using aliases and prefixes (Ensure you read through the below to familiarize yourself with the convention).

Note: LC_APP_NAMESPACE is a reserved key name and MUST NOT be overwritten.

Auto Resolve

If you call a class that wasn't imported in the . LaravelCustoms will automatically scan through the directory to find the class and import it on the fly. An Exception will be thrown if the class doesn't exist.

This approach is not recommended especially on large projects.

Credits

Sadiq Lukman, Artinict.
https://twitter.com/28thsly

License

The LaravelCustoms library is open-sourced software licensed under the MIT license.


All versions of laravel-customs with dependencies

PHP Build Version
Package Version
Requires php Version ^5.5.9 || ^7.0
illuminate/auth Version 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*
illuminate/contracts Version 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*
illuminate/http Version 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*
illuminate/support Version 5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*
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 artinict/laravel-customs contains the following files

Loading the files please wait ....