Download the PHP package gueff/phimcap without Composer

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

this class provides a captcha image you could use in your own html forms.

Requirements


Install

{
  "require": {
    "gueff/phimcap":"1.0.*"
  }
}

How to use

... a forgotPassword - Example using myMVC 3.2.x

assuming your primary working Module is called Foo:

1) dealing with html form

create a MIX /forgotPassword/ route, leading to \Foo\Controller\Index::forgotPassword

\MVC\Route::MIX(
    ['GET', 'POST'],
    '/forgotPassword/',
    '\Foo\Controller\Index::forgotPassword',
    $oDTRoutingAdditional
        ->set_sLayout($sTheme . '/Frontend/layout/index.tpl')
        ->set_sContent($sTheme . '/Frontend/content/forgotPassword.tpl')
        ->getPropertyJson()
);

\Foo\Controller\Index::forgotPassword: create new captcha text & save to Session

public function forgotPassword()
{
    // grab for POSTed captcha; sanitize
    $sCaptcha = substr(
        preg_replace("/[^\\p{L}\\p{N}']+/u", '', get($_POST['captcha'])),
        0,
        strlen(Session::is()->get('mymvc.captcha'))
    );

    if (
        ($sCaptcha === Session::is()->get('mymvc.captcha'))
    )
    {
        // stuff...
    }

    // create new captcha text & save to session
    $sCaptchaText = \Phimcap::text();
    Session::is()->set('mymvc.captcha', $sCaptchaText);

    $sContent = $this->oView->loadTemplateAsString('/Frontend/content/forgotPassword.tpl');
    $this->oView->assign('sContent', $sContent);
}

template /Frontend/content/forgotPassword.tpl

<form action="" method="post">
    <label for="captcha">Captcha</label>
    <img src="/captcha/">
    <input type="text"
           name="captcha"
           id="captcha" 
           class="form-control"
           value=""
           maxlength="5"
           placeholder="captcha code"
    >
</form>

2) serving the captcha image

create \Foo\Controller\Index::captcha

public function captcha()
{
    \Phimcap::image(
        Session::is()->get('mymvc.captcha')
    );
}

create a /captcha/ route, leading to \Foo\Controller\Index::captcha

\MVC\Route::GET(
    '/captcha/',
    '\Foo\Controller\Index::captcha'
);

So the captcha image is callable via

<img src="/captcha/">

Customizing

using different Font

Phimcap uses /usr/share/fonts/truetype/freefont/FreeMono.ttf, which is likely to be installed by default on Ubuntu Linux systems.

If you want a different Font, add the absolute path as second parameter:

\Phimcap::image(
    Session::is()->get('mymvc.captcha'),
    '/usr/share/fonts/truetype/msttcorefonts/andalemo.ttf'
);

text length

per default the text length is set to 5.

you can change it to a value between 5 up to 10 by adding a value as parameter.

$sCaptchaText = \Phimcap::text(10);

All versions of phimcap with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 gueff/phimcap contains the following files

Loading the files please wait ....