Download the PHP package codingwithrk/double-back-to-close without Composer

On this page you can find all versions of the php package codingwithrk/double-back-to-close. 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 double-back-to-close

Double Back to Close — NativePHP Mobile Plugin

Latest Version Packagist Downloads License

Image

Prompts users to press the back button twice before the app exits.

On the first back press a native toast is shown ("Press back again to exit"). If the user presses back again within the timeout the app exits. If the timeout elapses the state resets and the next back press starts the cycle over.

Supports NativePHP Mobile v3 and v4 (SuperNative). DoubleBackToClose::showToast() uses the Dialog facade to optionally surface the confirmation message as a rich dialog toast from PHP.


Requirements

Platform Minimum version
Android API 26 (Android 8)
iOS 18.2 (feature is a no-op; iOS has no hardware back button)

nativephp/mobile ^3.0 or ^4.0.


Installation

Publish the plugins provider (first time only):

Register this plugin (adds the service provider to your NativePluginsServiceProvider):

showToast() on NativePHP Mobile v3

On v4, Dialog ships inside nativephp/mobile core — no extra steps needed. On v3, Dialog is a separate plugin, so if you want to use DoubleBackToClose::showToast() install and register it too:

This is only required if you call showToast(); enable(), disable(), and configure() work without it.

Verify:


PHP Usage

Typical Livewire setup


Events

DoubleBackToCloseTriggered

Dispatched on the first back press. The native Android Toast has already been shown; listen to this event if you want to show a dialog toast via the Dialog facade instead.

Payload

Property Type Description
message string The configured toast message

AppExiting

Dispatched on the second back press, immediately before activity.finish() is called.


JavaScript Usage


How it works

Android

Enable registers an OnBackPressedCallback on the activity's onBackPressedDispatcher.

Disable removes the callback and clears all state.

Configure updates the message/timeout in-place without re-registering the callback.

iOS

iOS does not expose a hardware back button. The bridge functions accept and store configuration, and fire the same PHP events so cross-platform code stays consistent. Pair the feature with DoubleBackToClose::showToast() if you need visual feedback on iOS.


Support

For questions or issues, email [email protected]


License

The MIT License (MIT). Please see License File for more information.


All versions of double-back-to-close with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
nativephp/mobile Version ^3.0|^4.0
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 codingwithrk/double-back-to-close contains the following files

Loading the files please wait ...