Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pedra/affiliate_new
Astro & PHP application.
https://github.com/pedra/affiliate_new
Last synced: 3 months ago
JSON representation
Astro & PHP application.
- Host: GitHub
- URL: https://github.com/pedra/affiliate_new
- Owner: pedra
- Created: 2024-07-06T01:32:04.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-08-07T14:32:56.000Z (6 months ago)
- Last Synced: 2024-08-08T16:57:18.989Z (6 months ago)
- Language: PHP
- Size: 4.91 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Astro & PHP Application
<< [affiliate.freedomee.com](https://affiliate.freedomee.com) >>To start local development, open a terminal and type the following (one command at a time):
```sh
git clone https://github.com/pedra/affiliate_new.git
cd affiliate_new
npm install
npm run dev
```Open another terminal and type:
```sh
npm run php
```Now you have two servers running. One managed by Astro at ```localhost:4321/``` and the other by PHP (which must be installed on your local machine) at ```localhost/```, where it will carry out final tests before deploying to the production server.
### π Project Structure
Inside of your Astro project, you'll see the following folders and files:
```text
/
βββ server/
β βββ public/
β βββ php/
β βββ lib/
β βββ module/
β βββ template/
β βββ .env
β βββ router.php
β βββstart.php
βββ public/
β βββ .htaccess
β βββ index.php
β βββ < static files: css|js|img|etc... >
βββ src/
β βββ components/
β β βββ Card.astro
β βββ layouts/
β β βββ Layout.astro
β βββ pages/
β βββ index.astro
βββ package.json
βββ astro.config.mjs
βββ postbuild.mjs
```Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
Any static assets, like images, can be placed in the `public/` directory.
The ```server/php/``` directory is where the PHP server is written.
Astro's build targets the ```server/public/``` path used by the PHP server as a repository for static files.
The post-build script (```/postbuild.mjs```) locates the pages that have already been processed, replaces the ```[[name]]``` syntax with something like ```=$name?>``` for PHP access ("name" is any applicable variable name). The pages are moved to the ```/server/template/page/.php``` path, for the server-side PHP domain.
Deployment is done by uploading the contents of the ```server/``` folder, after processing, to a server with PHP, Apache2, and MySQL installed. The ```server/public/``` folder is exposed for public access. Everything else is behind it (protected).
### π§ Commands
All commands are run from the root of the project, from a terminal:
| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./app/public/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |
| `npm run php` | Start local PHP server at `localhost` |### π Want to learn more?
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
---
## β Buy me a coffee ?!
**Bill Rocha** | [billrocha.netlify.app](https://billrocha.netlify.app) | [email protected]_This software was written by human hands.._