Skip to content

Commit

Permalink
How to setup php project
Browse files Browse the repository at this point in the history
  • Loading branch information
eerison committed Sep 24, 2024
1 parent 8f9fa03 commit adb7dba
Show file tree
Hide file tree
Showing 14 changed files with 165 additions and 439 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PUBLIC_GOOGLE_SITE_VERIFICATION=7vlGZmcQOc0US8lHfVRJnE_w0zaDoEif0NXLD6Fh6rw

86 changes: 86 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Deploy

on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: cache
id: cache-frontend
uses: actions/cache@v3
with:
key: frontend-$NODE_ENV-${{ hashFiles('**/package-lock.json') }}
path: |
node_modules
restore-keys: |
frontend-$NODE_ENV-
frontend-
- run: npm install

deploy:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
pull-requests: write
needs: build
name: Deploy
env:
NODE_ENV: production
outputs:
preview_url: ${{ steps.cloudflare-deploy.outputs.url }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19

- uses: actions/cache@v3
with:
key: frontend-$NODE_ENV-${{ hashFiles('**/package-lock.json') }}
path: |
node_modules
restore-keys: |
frontend-$NODE_ENV-
frontend-
- run: npm run build

- name: Deploy
id: cloudflare-deploy
uses: cloudflare/pages-action@1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: erison-work # e.g. 'my-project'
directory: dist # e.g. 'dist'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

comment:
runs-on: ubuntu-latest
needs:
- deploy
name: Add comment in Pull request
steps:
- name: Comment PR
if: github.event_name == 'pull_request'
uses: mshick/add-pr-comment@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PREVIEW_URL: ${{ steps.cloudflare-deploy.outputs.url }}
with:
message: |
🚀 This branch can be previewed at ${{ needs.deploy.outputs.preview_url }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pnpm-debug.log*


# environment variables
.env
# .env
.env.production

# macOS-specific files
Expand Down
4 changes: 0 additions & 4 deletions .vscode/extensions.json

This file was deleted.

11 changes: 0 additions & 11 deletions .vscode/launch.json

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ All commands are run from the root of the project, from a terminal:

> **_Warning!_** Windows PowerShell users may need to install the [concurrently package](https://www.npmjs.com/package/concurrently) if they want to [run diagnostics](https://docs.astro.build/en/reference/cli-reference/#astro-check) during development (`astro check --watch & astro dev`). For more info, see [this issue](https://github.com/satnaing/astro-paper/issues/113).
> Warning! Windows PowerShell users may need to install the [concurrently package](https://www.npmjs.com/package/concurrently) if they want to [run diagnostics](https://docs.astro.build/en/reference/cli-reference/#astro-check) during development (`astro check --watch & astro dev`). For more info, see [this issue](https://github.com/satnaing/astro-paper/issues/113).
## ✨ Feedback & Suggestions

If you have any suggestions/feedback, you can contact me via [my email](mailto:[email protected]). Alternatively, feel free to open an issue if you find bugs or want to request new features.
Expand Down
361 changes: 0 additions & 361 deletions public/assets/dev.svg

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const { noMarginTop = false } = Astro.props;
<span>Copyright &#169; {currentYear}</span>
<span class="separator">&nbsp;|&nbsp;</span>
<span>All rights reserved.</span>
<span class="separator">&nbsp;|&nbsp;</span>
<span>Images by <a href="https://www.freepik.com">Freepik</a></span>
</div>
</div>
</footer>
Expand Down
22 changes: 11 additions & 11 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Site, SocialObjects } from "./types";

export const SITE: Site = {
website: "https://astro-paper.pages.dev/", // replace this with your deployed domain
author: "Sat Naing",
profile: "https://satnaing.dev/",
desc: "A minimal, responsive and SEO-friendly Astro blog theme.",
title: "AstroPaper",
website: "https://blog.erison.work",
profile: "https://blog.erison.work", // TODO: I do not know why we need this
author: "Erison Silva",
desc: "It's my personal blog, here I'm posting techinical posts and things that I consider intersting to share.",
title: "erison.work",
ogImage: "astropaper-og.jpg",
lightAndDarkMode: true,
postPerIndex: 4,
Expand All @@ -28,33 +28,33 @@ export const LOGO_IMAGE = {
export const SOCIALS: SocialObjects = [
{
name: "Github",
href: "https://github.com/satnaing/astro-paper",
href: "https://github.com/eerison",
linkTitle: ` ${SITE.title} on Github`,
active: true,
},
{
name: "Facebook",
href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Facebook`,
active: true,
active: false,
},
{
name: "Instagram",
href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Instagram`,
active: true,
active: false,
},
{
name: "LinkedIn",
href: "https://github.com/satnaing/astro-paper",
href: "https://www.linkedin.com/in/eerison",
linkTitle: `${SITE.title} on LinkedIn`,
active: true,
},
{
name: "Mail",
href: "mailto:yourmail@gmail.com",
href: "mailto:hey@gmail.com",
linkTitle: `Send an email to ${SITE.title}`,
active: false,
active: true,
},
{
name: "Twitter",
Expand Down
4 changes: 2 additions & 2 deletions src/content/blog/adding-new-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ modDatetime: 2023-12-21T09:12:47.400Z
title: Adding new posts in AstroPaper theme
slug: adding-new-posts-in-astropaper-theme
featured: true
draft: false
draft: true
tags:
- docs
description:
Some rules & recommendations for creating or adding new posts using AstroPaper
theme.
---

Here are some rules/recommendations, tips & ticks for creating new posts in AstroPaper blog theme.
### Soon I will update this post

## Table of contents

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
---
author: Erison Silva
pubDatetime: 2023-11-28T10:00:00Z
title: How to setup PHP easily on your machine
slug: how-to-setup-php-easily-on-your-machine
title: How to easily setup PHP on your machine
slug: how-to-easily-setup-php-on-your-machine
featured: true
draft: false
tags:
- php
- developer
- beginner
- setup
ogImage: https://blog.erison.work/_astro/how-to-setup-php-easily-on-your-machine.2b7537c4_Z6cLXe@3540w.jpeg
description: The easiest way to setup whole PHP stack locally with one command only.
description: The easiest way to setup the whole PHP stack locally with one command only.
---

![An astronauta carring a laptop](@assets/images/how-to-setup-php-easily-on-your-machine.jpg)

My goal with this post is you have a _PHP environment_ running on your machine quickly and easy.
I saw some people struggling to have this done, and tutorials that you need to follow a bunch of steps
for the end, you could run PHP on command line only 😔.

But on sections bellow, you going to find a setup with one **copy** and **past** command, and _you have a complete php stack running_
with a small php structure for you use as study guide in case, you are new on php land.

# Requirements
## Requirements

Before we start, you **MUST** have two tools already installed on your computer.

Expand All @@ -45,7 +42,7 @@ docker compose version

> For **Windows** users I would say that you must install [WSL][wsl_install_link] to have this working.
# Let's make this work 🚀
## Let's make this work 🚀

After you have done the requirements step, we can now run command to have this ready to play with php 🐘.

Expand All @@ -65,7 +62,7 @@ git clone https://github.com/shield-wall/easy-php-setup.git \
&& docker compose exec -T db sh -c 'exec mysql --defaults-extra-file=.docker/mysql/config.cnf' < .docker/mysql/dump.sql
```

# Troubleshooting
## Troubleshooting

In case the error bellow pop up on your terminal.

Expand All @@ -92,15 +89,15 @@ docker compose exec -T db sh -c 'exec mysql --defaults-extra-file=.docker/mysql/

> In case you find out other issue that is not related here, open an [issue][repository_issue_link] on github.
# Commands
## Commands

| Command | Description |
| ---------------------------------------- | -------------------------------------------------------------------- |
| docker compose up -d | Start the containers |
| docker compose down | Stop containers |
| docker compose exec php composer install | Execute some **php command** that you need, or **composer command**. |

# Frameworks
## Frameworks

This project should work, out the box, for the most _modern php frameworks_ such as [Symfony][symfony_link] and [Laravel][laravel_link].

Expand All @@ -109,7 +106,7 @@ In case you just want to use the environment, you can remove all files and keep
But if you find some strange behaviour, feel free to open an [issue][repository_issue_link]
or even better provide a PR to improve the [project][repository_link] 🚀.

# Study guide
## Study guide

As you can see I added a tiny php structure, I did this for two reasons.

Expand Down
68 changes: 46 additions & 22 deletions src/pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,58 @@ layout: ../layouts/AboutLayout.astro
title: "About"
---

AstroPaper is a minimal, responsive and SEO-friendly Astro blog theme. I designed and crafted this based on [my personal blog](https://satnaing.dev/blog).
Hello Hello,

This theme is aimed to be accessible out of the box. Light and dark mode are supported by
default and additional color schemes can also be configured.
I'm Erison Silva and I've been working in the past 10 years as Software developer.

This theme is self-documented \_ which means articles/posts in this theme can also be considered as documentations. So, see the documentation for more info.
## 📋 Resume

<div>
<img src="/assets/dev.svg" class="sm:w-1/2 mx-auto" alt="coding dev illustration">
</div>
Here you can download my last [resume](https://bucket.myprofile.pro/users/eerison/resume-default.pdf) version.

## Tech Stack
## ♥️ Open Source

This theme is written in vanilla JavaScript (+ TypeScript for type checking) and a little bit of ReactJS for some interactions. TailwindCSS is used for styling; and Markdown is used for blog contents.
Open source has been a topic that I always want to be be involved, and in Octuber 2020 I did my first Pull request for [Sonata User Bundle][first_pr_sonata_user]!
and Since there I ejoyed more and more contribute with OSS projects, Thanks Sonata Project for be so receptive and helpfull in my first contribuition <3.

## Features
### Myprofile project

Here are certain features of this site.
[Myprofile][myprofile_project], It is a open source project mantained by me, and I will dedicate a article just for this, it commes soon.

- fully responsive and accessible
- SEO-friendly
- light & dark mode
- fuzzy search
- super fast performance
- draft posts
- pagination
- sitemap & rss feed
- highly customizable
### Sonata page bundle 4

If you like this theme, you can star/contribute to the [repo](https://github.com/satnaing/astro-paper).
Or you can even give any feedback via my [email](mailto:[email protected]).
This new major was one of the most exited contribution that I have a plasure to be part of, everything started since one of the last companies that I worked uses this bundle and it was stuck on symfony version 4, and I pushed foword the initiative to relase the new major version.

It was a really huge amount of work and it toke aound 4 months the have this released, and I have learned a lot, maybe thing that I never learn in any company.
You can see this long effort in this [issue][sonata_page_bundle_4_issue]

> a special thank you for [Vincent Langlet][vincent_github] and [Jordi Sala Morales][jordi_gthub], for all support that you gave me.
### Rector phpunit

Rector is another php community really friendly, I started to contribute with this project since I was working in a phpunit upgrade, and I faced some code that I need to refactor manually and it was a pain, then I introduce a rule to make this automatic and I've adding more rules to help me with this automatic refactor.

> Thank you ractor for this amazing project, it is a really good example that community works <3
- [Rector][rector_src_prs]
- [Rector Phpunit][rector_phpunit_prs]

### All contributions

- [Myprofile project][myprofile_project]
- [Sonata Page Bundle][sonata_page_bundle_github_prs]
- [Sonata Page Bundle 4 recipe (Symfony flex)][github_prs_sonata_page_bundle_flex]
- [Sonata User Bundle][first_pr_sonata_user]
- [Rector][rector_src_prs]
- [Rector Phpunit][rector_phpunit_prs]
- [LexikJWTAuthenticationBundle][github_prs_jwt_authentication]

[first_pr_sonata_user]: https://github.com/sonata-project/SonataUserBundle/pull/1247
[sonata_page_bundle_4_issue]: https://github.com/sonata-project/SonataPageBundle/issues/1495
[sonata_page_bundle_github_prs]: https://github.com/sonata-project/SonataPageBundle/pulls?q=is%3Apr+author%3Aeerison+is%3Amerged
[vincent_github]: https://github.com/VincentLanglet
[jordi_gthub]: https://github.com/jordisala1991
[github_prs_jwt_authentication]: https://github.com/lexik/LexikJWTAuthenticationBundle/pulls?q=is%3Apr+eerison
[github_prs_sonata_page_bundle_flex]: https://github.com/symfony/recipes-contrib/pull/1440
[rector_phpunit_prs]: https://github.com/rectorphp/rector-phpunit/pulls?q=is%3Apr+author%3Aeerison
[rector_src_prs]: https://github.com/rectorphp/rector-src/pulls?q=is%3Apr+author%3Aeerison+
[myprofile_project]: https://github.com/shield-wall/myprofile
Loading

0 comments on commit adb7dba

Please sign in to comment.