Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

Hand Made

# 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.._ Hand Made