Recently i have had to work with laravel and creating a new repo and new laravel project (* honestly i kept forgetting a the command *) and it was sort of time consuming (something like that) so this script creates a new laravel project, git repo and also pushes it.
-
python. Python is need to run the script and also some pip installations
-
GitHub Token
- Login to your Github account.
- Go to Settings -> Developer Settings ->Personal Access Tokens
- Click on Generate new token. Confirm your password to continue.
- Give any description to your token.
- Under scopes check all you want the API to have access to in your account. I checked all the boxes.
- Click Generate new token.
- tanks to this meduim post. lot more github endpoints
- First install
pip install requests
so we can make the request to github api - First install
pip install python-dotenv
this so we can have an .evn file in the same root folder as create.py- Create A variable in the .evn called
GITHUB_USERNAME=
- Create A variable in the .evn called
GITHUB_TOKEN=
- You don't need to use and env file it's just safer soo yeah, you could go to create.py and hardcode your username and token still works
- Create A variable in the .evn called
-
You can run this by opening the root directory (where the create.py is) and running
python create.py name-of-project -repo -push -vs -lara
(this creates a laravel project, a github repo , and make an initial push to main) -
You will be prompted to Enter a path : give a path you want your project to be created ,repo created or pushed
python create.py name-of-project -repo
creates and initializes a repo with the name of project (please ensure the name is unique which means you have no other repo with the same name)python create.py name-of-project -repo -push
-push pushes the repo (-push must be used with -repo)python create.py name-of-project -vs
this opens up vs after script is runpython create.py name-of-project -lara
this creates a laravel projectpython create.py name-of-project -repo -push -vs -lara
creates, initializes , pushes and opens up vscode
I hope this helps !!! you could just ignore all this and create a project the normal way but what's the fun in that.