Download the PHP package projectmata/mobile-background-tasks without Composer

On this page you can find all versions of the php package projectmata/mobile-background-tasks. 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 mobile-background-tasks

Projectmata Mobile Background Tasks

Latest Version Total Downloads License

Background task scheduling plugin for NativePHP Mobile. Lets you define recurring jobs with Laravel's standard scheduler and run them via Android WorkManager and iOS BGTaskScheduler — even when the app is backgrounded or killed.

Heads-up — native runtime hookup required. The PHP, JS, and bridge layers are fully wired. The Android BackgroundTasksWorker and iOS BGTaskScheduler handlers ship as stubs — you'll fill those in to invoke your bundled artisan commands. See Native integration.

Requirements

Installation

Laravel auto-discovery registers the service provider, the facade, the schedule constraint macros, and the artisan command. Then rebuild the mobile app:

Defining tasks

Use Laravel's normal scheduler in routes/console.php. The plugin adds a set of mobile-aware constraint methods you can chain on:

After defining tasks, push them to the native runtime:

This walks the schedule, serialises each periodic event into a task descriptor, and calls the BackgroundTasks.Register bridge function.

Constraint methods

Method Android iOS
onAnyNetwork() NetworkType.CONNECTED requiresNetworkConnectivity = true
onWifi() NetworkType.UNMETERED requiresNetworkConnectivity = true
whileCharging() setRequiresCharging(true) requiresExternalPower = true
whenBatteryNotLow() setRequiresBatteryNotLow(true) Ignored
whenStorageNotLow() setRequiresStorageNotLow(true) Ignored
whenIdle() setRequiresDeviceIdle(true) Promotes to BGProcessingTask
longRunning() No-op Promotes to BGProcessingTask

Supported intervals

everyFifteenMinutes(), everyTwentyMinutes(), everyThirtyMinutes(), hourly(), everyTwoHours(), everyThreeHours(), everyFourHours(), everySixHours(), daily().

Other Laravel scheduler frequencies are ignored by the collector — both Android WorkManager and iOS BGTaskScheduler enforce minimum periodic intervals (15 minutes on Android, ~15 minutes practical floor on iOS).

PHP API

JavaScript API

Bridge methods

Method Params Returns
BackgroundTasks.Register { tasks: TaskDescriptor[] } { success, registered }
BackgroundTasks.RunNow { success, message }
BackgroundTasks.Cancel { taskId } { success, taskId }
BackgroundTasks.GetRegistered { success, tasks[] }

TaskDescriptor shape:

Native integration

Android

This package declares androidx.work:work-runtime-ktx:2.9.1. The Register bridge function enqueues a PeriodicWorkRequest per task with the right Constraints, but the worker itself (BackgroundTasksWorker.doWork()) is a stub. Replace the body with code that invokes the bundled artisan command on the embedded NativePHP runtime — typically by calling into the same PHP runner that powers the rest of your NativePHP app.

iOS

BGTaskScheduler requires every task identifier to be listed in Info.plist > BGTaskSchedulerPermittedIdentifiers. The plugin declares the com.projectmata.task.* prefix; iOS will reject any identifier outside that prefix.

You must register a handler in your AppDelegate (or SwiftUI App) for each identifier you submit:

The plugin's Register bridge submits the request; your handler runs the actual work.

Testing

Android (ADB):

iOS (Xcode LLDB):

Or just call BackgroundTasks::runNow() from PHP — it bypasses constraints and is intended for development only.

License

MIT


All versions of mobile-background-tasks with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.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 projectmata/mobile-background-tasks contains the following files

Loading the files please wait ...