Download the PHP package bhargavdetroja/nativephp-google-mobile-ads without Composer

On this page you can find all versions of the php package bhargavdetroja/nativephp-google-mobile-ads. 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 nativephp-google-mobile-ads

NativePHP Google Mobile Ads

Add Google AdMob ads to your NativePHP Mobile app in minutes. No Kotlin, no Swift, no Gradle edits.

Works with any frontend — Livewire, React, Vue, Alpine.js, or plain JavaScript.

Supports Banner, Interstitial, Rewarded, Rewarded Interstitial, and App Open on Android and iOS.


Requirements

NativePHP Mobile v4: this plugin works unchanged under v4's web view — the bridge functions, events, and Blade <x-google-ads::banner> component all keep working exactly as they do on v3. SuperNative-native NativeComponent screens are not required to use this plugin.


Installation

1. Install the package

2. Publish the config

3. Add your AdMob IDs to .env

Not ready for real IDs? Leave the values empty — when APP_ENV is not production, the plugin automatically uses Google's official demo IDs so you always see real test ads.

4. Run native install

Both App IDs are injected into native configs automatically from your .env. No vendor files to edit.


Configuration

config/google-mobile-ads.php gives you full control over ad placements, test mode, and the kill-switch.

Kill-switch

Disable all ads globally with one env key — useful for premium users or A/B testing.

Test mode

Automatically on when APP_ENV != production. Override if needed:

When active, Google's official demo IDs are substituted automatically — your real Ad Unit IDs are never used.

Named slots

Slots are named ad placements defined in your config. They support different IDs per platform:


Showing Ads

Option A — Blade component (banner only)

Drop a banner anywhere in your Blade views. Show/hide is handled automatically when the component mounts and unmounts.

Option B — PHP Facade

Option C — JavaScript (React, Vue, Alpine, plain JS)

The JS bridge accepts raw ad unit IDs. Slot resolution and test-mode substitution happen server-side via the Blade component or PHP Facade.

Pass the resolved ID from Blade so test-mode is respected:


Listening to Events

In JavaScript — works with any framework

React:

Vue:

In PHP — standard Laravel events

Register in AppServiceProvider:

Livewire:


All Events

Event Properties When it fires
AdLoaded $adType, $adUnitId Ad is ready to show
AdFailedToLoad $adType, $adUnitId, $errorCode, $errorMessage Ad failed to load
AdOpened $adType Full-screen ad appeared
AdClosed $adType Full-screen ad was dismissed
AdImpression $adType Ad recorded an impression
AdClicked $adType User tapped the ad
RewardEarned $rewardType, $rewardAmount User completed a rewarded ad

$adType values: banner, interstitial, rewarded, rewarded_interstitial, app_open


Going to Production

  1. Add your real Ad Unit IDs to .env.
  2. Set APP_ENV=production — test mode turns off automatically.
  3. Run php artisan native:install --force.
  4. Build your release: php artisan native:run android / php artisan native:run ios.

Troubleshooting

App crashes on iOS launch ADMOB_IOS_APP_ID is missing or wrong in your .env. Set it to your real iOS App ID and run php artisan native:install --force.

Ads not showing in development Test mode is likely on — this is correct behaviour. You should still see Google demo ads. If you see nothing, make sure you called initialize() and that you're on a real device (not iOS Simulator).

unknown slot exception You passed a slot name that isn't defined in config/google-mobile-ads.php. Either add it to slots, or pass a raw ca-app-pub-... ID directly.

Interstitial/Rewarded "not loaded" error You must call load*() and wait for the AdLoaded event before calling show*().

iOS Simulator shows no ads Google Mobile Ads SDK does not support iOS Simulator. Use a real iPhone.

Android emulator shows no ads The AVD must use a Google APIs system image — not plain Android or Google Play.

Validate plugin setup


License

MIT


All versions of nativephp-google-mobile-ads 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 bhargavdetroja/nativephp-google-mobile-ads contains the following files

Loading the files please wait ...