Has anyone seen PHP DB adapter code?

Hello!

I was hoping there would have been PHP example code for the database connectors. The only example code I could find are Wix’s prefab Node examples for Google’s AppEngine and Firestore.

I have searched high and low (maybe using the wrong search terms?) for a mySQL PHP connector I can use on my non-Wix site to talk to my organization’s Wix site.

I help with tech stuff for a dog rescue, and in updating some form stuff on Wix to talk to our in-house DB, I realized that the adoption coordinator has made about 400 static pages for dogs. Only 12-ish are ever active at a time, an on-Wix data collection is a great solution, but tying it into our own DB is 1000x better (though I bet I hit a wall with media slide shows translating).

Anyhow, if anyone has any pointers, in the mean time I’m going to be pulling the data from the 450 static pages and making sure it’s not throwaway, and is in our off-wit DB. :slight_smile:

Best,
Arlo

You won’t find any PHP in the Wix and Corvid resources. All of our code is Javascipt.

If you want to expose an API from your Wix site, see this example and the referenced resources:
Expose and Access Site APIs
Use MyApi and MyApiClient to expose and access external APIs.

If you are interested in accessing an external database, then see the article External Database Collections .

IMHO you would be better off with a Wix database where you can easily use dynamic pages to display all of your content.

No, not PHP on Wix. Sample code for a DB connector to interface with an existing PHP-driven site.

I know you guys don’t have one, that’s why I was hoping someone in the community had seen one in the wild, or had one to share.

I’ll dive into writing my own if one doesn’t exist. :slight_smile:

You can use the WixFetch API to access an external service. You’ll have to then expose your own API in your PHP site.

For information on using fetch in Wix, see these resources:

Here are some examples that use fetch to access third-party services:

Send Email with SendGrid REST Interface
Send an email using the SendGrid REST API.

Stripe Payment Processing
Integrate the Stripe Payment processing system into a site. Three levels of user access are demonstrated: visitor, freemium (registered), and premium (paid).

Using the Places API from Google Map Services
Demonstrates geolocation queries using the Google Maps Places API web services. The queries are performed in backend (server-side) web modules.

I’ve used the fetch API. Does that tie into collections?! If so, I’ll dig into it, for sure.

The fetch API does not tie into collections, it allows you to interface with an external service/site. You will need to implement http-functions on your side as query endpoints for the fetch queries originating from your Wix site.

This example illustrates how to expose and consume an API:

Expose and Access Site APIs
Use MyApi and MyApiClient to expose and access external APIs.

Per your other comment, our shelter has a robust system I’ve hand-written for managing our dogs (and humans, for that matter.) I’m trying to make life easier for our volunteers by having dogs entered in one place and propagating to Wix.

I’ll see if there’s and latency doing this with fetch. I also will need to research how to make sure valid slugs are created for a page created dynamically from fetch content.

I imagine that dogs are easier to manage then humans.

I was hoping to absorb this and try it out. Should I assume it either won’t work with syncing an off-site collection, or is out-of-date?

Edit: forgot link: