How to install composer

What is Composer

A composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

System Requirements

Composer requires PHP 5.3.2+ to run. A few sensitive PHP settings and compile flags are also required, but when using the installer you will be warned about any incompatibilities.

To install packages from sources instead of simple zip archives, you will need git, svn, fossil or hg depending on how the package is version-controlled.

Composer is multi-platform and we strive to make it run equally well on Windows, Linux, and macOS.

Installation Instruction

1) Use PHP to download the composer installer, place it in the current directory, and name it composer-setup.php
2) Use PHP to check the hash of the file you downloaded and compare it to the known value of the hash. You can always find the current value of the hash for the installer on the Composer Public Keys / Signatures page.
3) Run the setup program to install the composer. This does more than just download the latest copy of the composer, it also sets up your local ~/.composer directory. This will install the composer into the current directory. You can add the –install-dir=DIR to specify where you want the composer installed. You can also specify –filename=composer to change the installed filename. You can use anything you like that doesn’t already exist in your specified directory, you don’t have to use the name composer. This is a great way to get rid of the .phar at the end of the name if you don’t like it.
4) Use PHP to remove the installer from the current directory.

To install composer for PHP you use PHP to download the installer, set a few options, and then actually perform the install.

Follow these steps to install the composer.

Typography Helper in codeigniter

Typography Helper

The Typography Helper file contains functions that help your format text in semantically relevant ways.

Loading this Helper
This helper is loaded using the following code:

Available Functions
The following functions are available:

auto_typography($str[, $reduce_linebreaks = FALSE])

Parameters:
  • $str (string) – Input string
  • $reduce_linebreaks (bool) – Whether to reduce multiple instances of double newlines to two
  • Returns:HTML-formatted typography-safe string
    Return type:string

    Formats text so that it is semantically and typographically correct HTML.
    This function is an alias for CI_Typography::auto_typography(). For more info, please see the Typography Library documentation.
    Usage example:

    Note! Typographic formatting can be processor intensive, particularly if you have a lot of content being formatted. If you choose to use this function you may want to consider caching your pages.

    nl2br_except_pre($str)

    Parameters:
  • $str (string) – Input string
  • Returns:String with HTML-formatted line breaks
    Return type:string

    Converts newlines to tags unless they appear within tags. This function is identical to the native PHP nl2br() function, except that it ignores tags.
    Usage example:


    entity_decode($str, $charset = NULL)

    Parameters:
  • $str (string) – Input string
  • $charset (string) – Character set
  • Returns:String with decoded HTML entities
    Return type:string

    This function is an alias for CI_Security::entity_decode(). Fore more info, please see the Security Library documentation.

    Creating Ancillary Classes

    In some cases you may want to develop classes that exist apart from your controllers but have the ability to utilize all of CodeIgniter’s resources. This is easily possible as you’ll see.

    get_instance()

    Returns: Reference to your controller’s instance
    Return type: CI_Controller

    Any class that you instantiate within your controller methods can access CodeIgniter’s native resources simply by using the get_instance() function. This function returns the main CodeIgniter object.

    Normally, to call any of the available CodeIgniter methods requires you to use the $this construct:

    $this, however, only works within your controllers, your models, or your views. If you would like to use CodeIgniter’s classes from within your own custom classes you can do so as follows:

    First, assign the CodeIgniter object to a variable:

    Once you’ve assigned the object to a variable, you’ll use that variable instead of $this:

    If you’ll be using get_instance() inside another class, then it would be better if you assign it to a property. This way, you won’t need to call get_instance() in every single method.

    Example:

    In the above example, both methods foo() and bar() will work after you instantiate the Example class, without the need to call get_instance() in each of them.

    Login with linkedin in php

    LinkedIn is a business and employment-oriented social networking service that operates via websites. it is mainly used for professional networking, including employers posting jobs and job seekers posting their CVs. LinkedIn allows users (workers and employers) to create profiles and “connections” to each other in an online social network which may represent real-world professional relationships. Users can invite anyone (whether a site user or not) to become a connection. Read More

    Language helper in codeigniter

    Language helper

    The Language Helper file contains functions that assist in working with language files.

    Loading this Helper

    This helper is loaded using the following code:

    Available Functions

    The following functions are available:

    lang($line[, $for = ”[, $attributes = array()]])

    Parameters:
  • $line (string) – Language line key
  • $for (string) – HTML “for” attribute (ID of the element we’re creating a label for)
  • $attributes (array) – Any additional HTML attributes
  • Returns:The language line; in an HTML label tag, if the $for parameter is not empty
    Return type:string

    This function returns a line of text from a loaded language file with simplified syntax that may be more desirable for view files than CI_Lang::line().

    Examples:

    Auto-loading Resources

    CodeIgniter comes with an “Auto-load” feature that permits libraries, helpers, and models to be initialized automatically every time the system runs. If you need certain resources globally throughout your application you should consider auto-loading them for convenience.

    The following items can be loaded automatically:

    1) Classes found in the libraries/ directory
    2) Helper files found in the helpers/ directory
    3) Custom config files found in the config/ directory
    4) Language files found in the system/language/ directory
    5) Models found in the models/ folder

    To autoload resources, open the application/config/autoload.php file and add the item you want loaded to the autoload array. You’ll find instructions in that file corresponding to each type of item.

    Do not include the file extension (.php) when adding items to the autoload array.

    Additionally, if you want CodeIgniter to use a Composer auto-loader, just set $config[‘composer_autoload’] to TRUE or a custom path in application/config/config.php.