Categories
Resources Web Development

PHP Namespace information, links and resources

It is important to understand what namespaces are in PHP and how to use them. Otherwise you will be lost and have many pains.

Videos

Below is a series of great videos explaining PHP namespaces little by little in easy to find and digest chunks.\
PHP namespaces 1/10: What is a namespace in PHP?









Everything about PHP namespaces – OOP in PHP | Part 10

Categories
Resources Web Development

How to output Symfony environmental variables

I couldn’t remember where the hell I had seen this in the documentation so I am linking to it here. Why?

Because it absolutely isn’t where you would expect it to be like listed under Environmental variables. Hell no why list that shit there that’s all logical and shit.

It is actually under configuration all the way to the bottom under “List environment variables.” Would be so nice if that was in the Enironmental Variables page instead or a link to it or mention of it.

Categories
Resources Web Development

AML KYC & Age Verification resources and links

Mati – provides AML/KYC/Age verification

Categories
Resources Web Development

Symfony how to list environmental variables

I know I’ll never remember where I saw this. One day I will need to dump or check the environmental variables for my app.

The documentation here lists how to check the environmental variables towards the bottom of the page.

Categories
Resources Web Development

Symfony framework links with descriptions

I have this problem where I remember like 75% of what I read, but can’t remember where when I want to review information to make sure I remember things correctly. I prefer to look things up rather than screw them up based on memory, because I would screw things up at least 25% of the time. LOL

So this is my list of symfony documentation links with explanations so I can remember where I read what later.

How to Use a Form without a Data Class – from the docs, this example and article talk about how to create forms where the data of the form belongs to two different tables. A lot of the time data from forms will be stored in multiple tables then reassembled when needed later. Symfony quick docs assume you are having a 1:1 form to table situation or using an ORM I hate ORM’s I have seen them destroy the performance of apps and you don’t know until PRODUCTION TIME WOOHOOO YAY!!!!!!! You should see the goofey ass structure some create and the insane queries.

Forms – Symfony documentation mentioned above. This assumes the 1:1 table to form use case. This is rarely the case for me. This works best with data that can be stored in NoSQL databases. NoSQL is all the rage and hype because new developers have no clue what they are doing. NoSQL has specific use cases otherwise you are creating a bowl of mashed spaghetti which will eventually become so slow your app will fail due to users quitting. NoSQL is best when your data structure will change or has no real definition. User profiles are a good use case for NoSQL. RDBMS have their specific use cases and so do Graph databases. NoSQL has many forms too, document store, key value and more. Learning the different types of Database and what they are used for will prevent you from making a bowl of Mashed spaghetti. This book is has excellent coverage of the subjects.

Categories
Resources Web Development

Symfony encore webpack compiling scss

I couldn’t remember where the hell in the documentation I saw this. This is how you tell yarn to run encore and compile everything.

Down below the section Configuring Encore/webpack

Categories
Resources Web Development

CSS resources links and information

A complete guide to flexbox – Great introduction and coverage of flexbox and how to use it to layout content.

Floats vs inline-block – We used to use float and inline-block for content layout.

Progressively Enhanced CSS Layouts: Floats to Flexbox & Grid – great article explaining how we got to Flexbox and grid and how to use them for page layouts

Categories
Resources Software Development Web Development

yaml resources and links

Yaml is used for configuration of different software used for development.

WHY JSON ISN’T A GOOD CONFIGURATION LANGUAGE – good article that explains why yaml is better for configuration than json. When I originally encountered yaml I was like WTF another damn BS PITA I have to learn. Honestly I don’t learn this shit more than what I need to get things done. Your brain only remembers about 23% of what you learn 12 months later anyways. So trying to learn things 100% inside and out is over 75% a waste of time. LOL

Yaml website – reference card

Yaml primer – great intro on github

 

Categories
Software Development Web Development

How to install Nodejs npm nvm without sudo on linux

For a few days I have been wrestling with nvm, nodejs, php composer etc. trying to figure out why the hell I keep getting permission issues.

I followed the instructions and installed them without being the root user… or so I thought.  I completely failed to understand what was going on with permissions.

I tried to install composer and node while in the directory I usually use for my web server /var/www/app-folder .  When given permission denied errors I did the normal thing and added sudo.

I fully failed to understand WTF sudo does.

In my world, as long as I didn’t login as the root  I was still the user that is shown in the terminal myself@myself$. I figured that adding sudo kept me as the user I was shown as in the terminal.

It seems logical right, you use sudo and you never see your terminal user change to root, therefore you must not be root.

Nope when you use sudo apparently this not only elevates your privileges as a user, it totally changes you to the root user. More info about the nonsense of sudo in linux  

i am root
i am root

The reason I was getting errors and having to use sudo in the first place is because I was trying to install stuff from a folder owned by root but had permissions for group which my user was a member of.

I falsely assumed that using sudo kept me as the user I was only giving me higher privilege levels. Apparently sudo in fact makes you the root user for a short period, which is the same as sudo -i which leaves you logged in as the root.

To prevent these errors and install things not as root and not using sudo, you must be in a folder that your current user owns and is not just a member of a group of. I’ve been using Linux for a decade but never tried installing node, other software like compilers etc don’t give a shit and work.

For so long I’ve installed and built apps in /var/www/directory because that was always the default for Apache and Nginx.  This is an issue for people trying to package their node apps too from what I have read.

This creates another conundrum. Which folder should you use for web development? Which one should you put your apps in in docker containers?

The problem is, you need to research more to fully understand the implications of creating a directory with the current user as owner. You must understand what permission levels will be safe on a server. What is the minimum permissions for your user you need and still be safe?

So when installing node, nvm, npm or php composer, do it in a file your user owns. If you are installing for development you can do it right from the users Download folder for example, that one is owned by the user. But whatever you do, do not use sudo and do not install from any folder owned by root.

Link explaining file permissions

Categories
Resources Web Development

Installing PHP composer programmatically with a bash script on linux

The easiest way to install Composer is by using the bash script provided here.  What I do is use vim to create a file named composer-install.sh then post that script in it.

I do this in any folder, then I move the script to make it global as suggested in the documentation here.

Basically all you are doing is using the linux mv command to move the composer.phar script so it is in the users global space.